diff --git a/Backend/ERPCore.Tests/ERPCore.Tests.csproj b/Backend/ERPCore.Tests/ERPCore.Tests.csproj index b2bafa9..7d1167a 100644 --- a/Backend/ERPCore.Tests/ERPCore.Tests.csproj +++ b/Backend/ERPCore.Tests/ERPCore.Tests.csproj @@ -8,7 +8,7 @@ - + diff --git a/Backend/ERPCore.Tests/NotificationConfigServiceTests.cs b/Backend/ERPCore.Tests/NotificationConfigServiceTests.cs index 6588fd3..f7dc27b 100644 --- a/Backend/ERPCore.Tests/NotificationConfigServiceTests.cs +++ b/Backend/ERPCore.Tests/NotificationConfigServiceTests.cs @@ -30,7 +30,7 @@ public class NotificationConfigServiceTests var result = await service.GetAsync(); - Assert.Equal(7u, result.RowVersion); + Assert.Equal(1u, result.RowVersion); Assert.Contains(result.Value.Modules, m => m.ModuleKey == "sale.create" && m.EmailEnabled && !m.SmsEnabled && m.InAppEnabled); Assert.Contains(result.Value.Modules, m => m.ModuleKey == "grn.confirmed" && !m.EmailEnabled && !m.SmsEnabled && !m.InAppEnabled); } @@ -55,9 +55,9 @@ public class NotificationConfigServiceTests }).ToList() }; - var updated = await service.UpdateAsync(request, 7); + var updated = await service.UpdateAsync(request, 1); - Assert.Equal(7u, updated.RowVersion); + Assert.Equal(2u, updated.RowVersion); Assert.Contains(updated.Value.Modules, m => m.ModuleKey == catalog.GetAll()[0].Key && m.EmailEnabled && !m.SmsEnabled && !m.InAppEnabled); Assert.Contains(updated.Value.Modules, m => m.ModuleKey == catalog.GetAll()[1].Key && !m.EmailEnabled && m.SmsEnabled && m.InAppEnabled); @@ -133,7 +133,7 @@ public class NotificationConfigServiceTests }).ToList() }; - var ex = await Assert.ThrowsAsync(() => service.UpdateAsync(request, 7)); + var ex = await Assert.ThrowsAsync(() => service.UpdateAsync(request, 1)); Assert.Equal(ErrorCodes.ConcurrencyConflict, ex.Code); Assert.Equal(412, ex.StatusCode); } diff --git a/Backend/ERPCore.Tests/ProductionConcurrencyTests.cs b/Backend/ERPCore.Tests/ProductionConcurrencyTests.cs new file mode 100644 index 0000000..9deeee6 --- /dev/null +++ b/Backend/ERPCore.Tests/ProductionConcurrencyTests.cs @@ -0,0 +1,124 @@ +using ERPCore.Domain.Entities; +using ERPCore.Domain.Enums; +using ERPCore.Dtos.Production; +using ERPCore.Infra.Auth; +using ERPCore.Infra.Persistence; +using ERPCore.Repositories; +using ERPCore.Services.Production; +using ERPCore.System.Errors; +using ERPCore.Tests.TestSupport; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Storage; + +namespace ERPCore.Tests; + +/// +/// Covers the 412 translation on the two production services, which save through +/// ExecuteInTransactionAsync rather than a bare SaveChangesAsync and so guard +/// concurrency differently from the inline pattern the other services use. +/// +public class ProductionConcurrencyTests +{ + private static readonly InMemoryDatabaseRoot Root = new(); + + [Fact] + public async Task TemplateUpdateAsync_MapsConcurrencyFailuresToDomainException() + { + await using var db = CreateContext(); + + // Validation runs before the transaction opens, so the referenced item has to exist. + db.Items.Add(new Item + { + ItemId = 1, + Sku = "FG-1", + Name = "Finished good", + CategoryId = 1, + BaseUomId = 1, + Status = EntityStatus.Active + }); + await db.SaveChangesAsync(); + + var service = CreateTemplateService(db); + + var ex = await Assert.ThrowsAsync( + () => service.UpdateAsync(1, SingleStageTemplate(), expectedRowVersion: 1)); + + Assert.Equal(ErrorCodes.ConcurrencyConflict, ex.Code); + Assert.Equal(412, ex.StatusCode); + } + + [Fact] + public async Task RunUpdateStageQuantitiesAsync_MapsConcurrencyFailuresToDomainException() + { + await using var db = CreateContext(); + var service = CreateRunService(db); + + var ex = await Assert.ThrowsAsync( + () => service.UpdateStageQuantitiesAsync(1, 1, new UpdateStageQuantitiesRequest())); + + Assert.Equal(ErrorCodes.ConcurrencyConflict, ex.Code); + Assert.Equal(412, ex.StatusCode); + } + + /// + /// The smallest graph the validator accepts: one stage (both entry and terminal) with a + /// stock input and a single item-bearing output, and no edges. + /// + private static SaveTemplateRequest SingleStageTemplate() => new() + { + Code = "TPL-1", + Name = "Template 1", + Stages = + [ + new SaveStageRequest + { + Key = "tmp-1", + Name = "Mix", + Inputs = + [ + new SaveInputRequest + { + Source = StageInputSource.Stock, + ItemId = 1, + QtyUnit = StageQtyUnit.Pack, + QtyPerBatch = 1m + } + ], + Outputs = + [ + new SaveOutputRequest { Key = "tmp-o1", Name = "Output", ItemId = 1, QtyPerBatch = 1m } + ] + } + ] + }; + + private static ErpDbContext CreateContext() + { + var options = new DbContextOptionsBuilder() + .UseInMemoryDatabase(Guid.NewGuid().ToString("N"), Root) + .Options; + + // The real CurrentBranchContext over an unauthenticated user yields IsActive=false, + // which leaves the branch query filters off: what a unit test wants. + var currentUser = new TestCurrentUser(); + return new ErpDbContext(options, currentUser, new CurrentBranchContext(currentUser)); + } + + private static ProductionTemplateService CreateTemplateService(ErpDbContext db) + => new( + new Repository(db), new Repository(db), + new Repository(db), new Repository(db), + new Repository(db), new Repository(db), + new Repository(db), new Repository(db), + new ThrowingTransactionUnitOfWork(), new TestCurrentUser()); + + // The costing, measurement and numbering collaborators are only ever touched inside the + // transaction lambda, which ThrowingTransactionUnitOfWork never invokes. + private static ProductionRunService CreateRunService(ErpDbContext db) + => new( + new Repository(db), new Repository(db), + new Repository(db), new Repository(db), + new Repository(db), new Repository(db), + fifo: null!, measure: null!, numbers: null!, + new ThrowingTransactionUnitOfWork(), new TestCurrentUser()); +} diff --git a/Backend/ERPCore.Tests/TestSupport/NotificationConfigTestSupport.cs b/Backend/ERPCore.Tests/TestSupport/NotificationConfigTestSupport.cs index 55128d3..cea732a 100644 --- a/Backend/ERPCore.Tests/TestSupport/NotificationConfigTestSupport.cs +++ b/Backend/ERPCore.Tests/TestSupport/NotificationConfigTestSupport.cs @@ -11,6 +11,12 @@ internal sealed class TestCurrentUser : ICurrentUser public string UserId => "system"; public int AuditUserId => User.SystemUserId; public bool IsAuthenticated => false; + + // Unauthenticated, so no role claim and no branch scoping: the three members the + // AuthHex integration added to ICurrentUser. + public string? RoleCode => null; + public bool IsAdmin => false; + public int? BranchId => null; } internal sealed class ThrowingUnitOfWork : ERPCore.Infra.UoW.IUnitOfWork @@ -25,6 +31,25 @@ internal sealed class ThrowingUnitOfWork : ERPCore.Infra.UoW.IUnitOfWork => throw new NotSupportedException(); } +/// +/// Fails the transactional path the way a lost optimistic-concurrency race does, so the +/// services that save through ExecuteInTransactionAsync can be covered too. The +/// lambda is never invoked, which is the point: the real UnitOfWork issues its own +/// SaveChangesAsync after the lambda returns, so the catch under test has to sit +/// outside it. +/// +internal sealed class ThrowingTransactionUnitOfWork : ERPCore.Infra.UoW.IUnitOfWork +{ + public Task SaveChangesAsync(CancellationToken ct = default) + => throw new DbUpdateConcurrencyException("Test concurrency conflict."); + + public Task ExecuteInTransactionAsync(Func action, CancellationToken ct = default) + => throw new DbUpdateConcurrencyException("Test concurrency conflict."); + + public Task ExecuteInTransactionAsync(Func> action, CancellationToken ct = default) + => throw new DbUpdateConcurrencyException("Test concurrency conflict."); +} + internal static class NotificationConfigTestSupport { private static readonly InMemoryDatabaseRoot Root = new(); @@ -35,7 +60,10 @@ internal static class NotificationConfigTestSupport .UseInMemoryDatabase(name, Root) .Options; - return new ErpDbContext(options, new TestCurrentUser()); + // The real CurrentBranchContext over an unauthenticated user yields IsActive=false, + // which leaves the branch query filters off: what a unit test wants. + var currentUser = new TestCurrentUser(); + return new ErpDbContext(options, currentUser, new CurrentBranchContext(currentUser)); } public static async Task SeedAsync(ErpDbContext db, IEnumerable? modules = null) @@ -52,7 +80,8 @@ internal static class NotificationConfigTestSupport NotificationConfigId = NotificationConfig.SingletonId, UpdatedBy = User.SystemUserId, UpdatedAt = DateTime.UtcNow, - RowVersion = 7, + // No RowVersion here on purpose: ErpDbContext.BumpRowVersions stamps every + // inserted row with 1, so any seeded value is overwritten on save. }; if (modules is not null) diff --git a/Backend/ERPCore/Controllers/ProductionRunsController.cs b/Backend/ERPCore/Controllers/ProductionRunsController.cs index 97c41f5..423644c 100644 --- a/Backend/ERPCore/Controllers/ProductionRunsController.cs +++ b/Backend/ERPCore/Controllers/ProductionRunsController.cs @@ -56,6 +56,7 @@ public sealed class ProductionRunsController : ApiControllerBase [ProducesResponseType(typeof(RunGraphDto), StatusCodes.Status201Created)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status422UnprocessableEntity)] + [ProducesResponseType(StatusCodes.Status412PreconditionFailed)] public async Task> Create([FromBody] CreateRunRequest request, CancellationToken ct) { var result = await _runs.CreateAsync(request, ct); @@ -69,6 +70,7 @@ public sealed class ProductionRunsController : ApiControllerBase [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status409Conflict)] [ProducesResponseType(StatusCodes.Status422UnprocessableEntity)] + [ProducesResponseType(StatusCodes.Status412PreconditionFailed)] public async Task> UpdateQuantities( int runId, int runStageId, [FromBody] UpdateStageQuantitiesRequest request, CancellationToken ct) => Ok(await _runs.UpdateStageQuantitiesAsync(runId, runStageId, request, ct)); @@ -86,6 +88,7 @@ public sealed class ProductionRunsController : ApiControllerBase [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status409Conflict)] [ProducesResponseType(StatusCodes.Status422UnprocessableEntity)] + [ProducesResponseType(StatusCodes.Status412PreconditionFailed)] public async Task> Start( int runId, int runStageId, [FromHeader(Name = "Idempotency-Key")] string? idempotencyKey, @@ -98,6 +101,7 @@ public sealed class ProductionRunsController : ApiControllerBase [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status409Conflict)] [ProducesResponseType(StatusCodes.Status422UnprocessableEntity)] + [ProducesResponseType(StatusCodes.Status412PreconditionFailed)] public async Task> Complete( int runId, int runStageId, [FromBody] CompleteStageRequest request, [FromHeader(Name = "Idempotency-Key")] string? idempotencyKey, @@ -109,6 +113,7 @@ public sealed class ProductionRunsController : ApiControllerBase [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status409Conflict)] [ProducesResponseType(StatusCodes.Status422UnprocessableEntity)] + [ProducesResponseType(StatusCodes.Status412PreconditionFailed)] public async Task> Approve( int runId, int runStageId, [FromBody] ApproveStageRequest? request, [FromHeader(Name = "Idempotency-Key")] string? idempotencyKey, @@ -120,6 +125,7 @@ public sealed class ProductionRunsController : ApiControllerBase [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status409Conflict)] [ProducesResponseType(StatusCodes.Status422UnprocessableEntity)] + [ProducesResponseType(StatusCodes.Status412PreconditionFailed)] public async Task> Transfer( int runId, int runStageId, [FromBody] TransferRemainderRequest request, [FromHeader(Name = "Idempotency-Key")] string? idempotencyKey, @@ -132,6 +138,7 @@ public sealed class ProductionRunsController : ApiControllerBase [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status409Conflict)] [ProducesResponseType(StatusCodes.Status422UnprocessableEntity)] + [ProducesResponseType(StatusCodes.Status412PreconditionFailed)] public async Task> ReturnLeftover( int runId, int runInputId, [FromBody] ReturnLeftoverRequest request, [FromHeader(Name = "Idempotency-Key")] string? idempotencyKey, @@ -142,6 +149,7 @@ public sealed class ProductionRunsController : ApiControllerBase [ProducesResponseType(typeof(RejectIntakeResultDto), StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status409Conflict)] + [ProducesResponseType(StatusCodes.Status412PreconditionFailed)] public async Task> RejectIntake( int runId, int runStageId, [FromBody] RejectRequest? request, [FromHeader(Name = "Idempotency-Key")] string? idempotencyKey, @@ -153,6 +161,7 @@ public sealed class ProductionRunsController : ApiControllerBase [ProducesResponseType(typeof(TerminalRejectResultDto), StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status409Conflict)] + [ProducesResponseType(StatusCodes.Status412PreconditionFailed)] public async Task> Reject( int runId, int runStageId, [FromBody] RejectRequest? request, [FromHeader(Name = "Idempotency-Key")] string? idempotencyKey, @@ -165,6 +174,7 @@ public sealed class ProductionRunsController : ApiControllerBase [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status409Conflict)] [ProducesResponseType(StatusCodes.Status422UnprocessableEntity)] + [ProducesResponseType(StatusCodes.Status412PreconditionFailed)] public async Task> Cancel( int runId, [FromBody] CancelRunRequest request, [FromHeader(Name = "Idempotency-Key")] string? idempotencyKey, diff --git a/Backend/ERPCore/Domain/Entities/Branch.cs b/Backend/ERPCore/Domain/Entities/Branch.cs index bf71632..4f0ecf2 100644 --- a/Backend/ERPCore/Domain/Entities/Branch.cs +++ b/Backend/ERPCore/Domain/Entities/Branch.cs @@ -9,6 +9,18 @@ namespace ERPCore.Domain.Entities; /// public class Branch { + /// + /// Code of the deployment's default branch. Every branch-scoped entity has a + /// non-nullable BranchId with a Restrict FK, so this row must exist before any + /// of them can be written — see DataSeeder.EnsureDefaultBranchAsync, which + /// creates it at startup, and BranchConfigService.ResolveDefaultBranchIdAsync, + /// which is the lazy runtime fallback. + /// + public const string DefaultCode = "BR-000"; + + /// Display name paired with . + public const string DefaultName = "Main Branch"; + public int BranchId { get; set; } /// Server-generated on create ("BR-001", "BR-002", ...) — never accepted from the client. diff --git a/Backend/ERPCore/Domain/Entities/BundleSale.cs b/Backend/ERPCore/Domain/Entities/BundleSale.cs index cfdb355..c0109ac 100644 --- a/Backend/ERPCore/Domain/Entities/BundleSale.cs +++ b/Backend/ERPCore/Domain/Entities/BundleSale.cs @@ -27,7 +27,7 @@ public class BundleSale public decimal GrandTotal { get; set; } public DateTime CreatedAt { get; set; } public DateTime? UpdatedAt { get; set; } - public int ConcurrencyStamp { get; set; } + public uint RowVersion { get; set; } /// Set once this bundle's business date is closed by — a /// closed bundle sale is frozen (no further edits). Same role as ; diff --git a/Backend/ERPCore/Domain/Entities/BundleSaleTemplate.cs b/Backend/ERPCore/Domain/Entities/BundleSaleTemplate.cs index 0343a23..974e272 100644 --- a/Backend/ERPCore/Domain/Entities/BundleSaleTemplate.cs +++ b/Backend/ERPCore/Domain/Entities/BundleSaleTemplate.cs @@ -11,7 +11,7 @@ public class BundleSaleTemplate public EntityStatus Status { get; set; } = EntityStatus.Active; public DateTime CreatedAt { get; set; } public DateTime? UpdatedAt { get; set; } - public int ConcurrencyStamp { get; set; } + public uint RowVersion { get; set; } public ICollection Lines { get; set; } = new List(); } diff --git a/Backend/ERPCore/ERPCore.csproj b/Backend/ERPCore/ERPCore.csproj index e6214e4..3a06a92 100644 --- a/Backend/ERPCore/ERPCore.csproj +++ b/Backend/ERPCore/ERPCore.csproj @@ -1,4 +1,4 @@ - + net10.0 @@ -10,18 +10,18 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - + diff --git a/Backend/ERPCore/Infra/Persistence/Auditing/AuditScribe.cs b/Backend/ERPCore/Infra/Persistence/Auditing/AuditScribe.cs index 2df34ab..8878091 100644 --- a/Backend/ERPCore/Infra/Persistence/Auditing/AuditScribe.cs +++ b/Backend/ERPCore/Infra/Persistence/Auditing/AuditScribe.cs @@ -78,7 +78,11 @@ public static class AuditScribe foreach (var p in entry.Properties) { if (p.Metadata.IsPrimaryKey()) continue; - if (p.Metadata.Name == nameof(Item.RowVersion)) continue; + // Semantic rather than name-matched: covers every concurrency token automatically + // and survives a rename. (This used to be `Name == nameof(Item.RowVersion)`, which + // silently missed BundleSale/BundleSaleTemplate's differently-named token and so + // leaked it into every bundle-sale change set.) + if (p.Metadata.IsConcurrencyToken) continue; switch (action) { diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/AttendanceRecordConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/AttendanceRecordConfiguration.cs index 64e1803..e4fecee 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/AttendanceRecordConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/AttendanceRecordConfiguration.cs @@ -22,8 +22,6 @@ public sealed class AttendanceRecordConfiguration : IEntityTypeConfiguration r.WorkShift).WithMany() .HasForeignKey(r => r.WorkShiftId).OnDelete(DeleteBehavior.Restrict); - builder.Property(r => r.RowVersion).IsRowVersion(); - builder.HasIndex(r => new { r.EmployeeId, r.AttendanceDate }); builder.HasIndex(r => r.AttendanceUploadBatchId); } diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/AttendanceUploadBatchConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/AttendanceUploadBatchConfiguration.cs index 30645a4..f46695e 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/AttendanceUploadBatchConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/AttendanceUploadBatchConfiguration.cs @@ -19,7 +19,6 @@ public sealed class AttendanceUploadBatchConfiguration : IEntityTypeConfiguratio builder.Property(b => b.Status).HasConversion().HasMaxLength(20).IsRequired(); builder.Property(b => b.UploadedAt).IsRequired(); - builder.Property(b => b.RowVersion).IsRowVersion(); builder.HasIndex(b => b.Status); builder.HasIndex(b => new { b.PeriodStart, b.PeriodEnd }); diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/AuditConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/AuditConfiguration.cs index a93681c..f8d888f 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/AuditConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/AuditConfiguration.cs @@ -13,7 +13,7 @@ public sealed class AuditLogConfiguration : IEntityTypeConfiguration builder.Property(a => a.EntityType).IsRequired().HasMaxLength(80); builder.Property(a => a.Action).HasConversion().HasMaxLength(10).IsRequired(); - builder.Property(a => a.ChangeSet).IsRequired().HasColumnType("jsonb"); + builder.Property(a => a.ChangeSet).IsRequired().HasColumnType("longtext"); builder.Property(a => a.CreatedAt).IsRequired(); builder.HasOne().WithMany().HasForeignKey(a => a.UserId).OnDelete(DeleteBehavior.Restrict); diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/BranchConfigConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/BranchConfigConfiguration.cs index e60df23..bd403f8 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/BranchConfigConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/BranchConfigConfiguration.cs @@ -13,7 +13,7 @@ public sealed class BranchConfigConfiguration : IEntityTypeConfiguration builder) { builder.ToTable("branch_config", t => - t.HasCheckConstraint("ck_branch_config_singleton", $"\"ConfigId\" = {BranchConfig.SingletonId}")); + t.HasCheckConstraint("ck_branch_config_singleton", $"`ConfigId` = {BranchConfig.SingletonId}")); builder.HasKey(c => c.ConfigId); @@ -22,9 +22,6 @@ public sealed class BranchConfigConfiguration : IEntityTypeConfiguration c.BranchingEnabled).IsRequired().HasDefaultValue(true); - // PostgreSQL xmin system column as the optimistic concurrency token (ETag). - builder.Property(c => c.RowVersion).IsRowVersion(); - builder.HasOne(c => c.UpdatedByUser) .WithMany() .HasForeignKey(c => c.UpdatedBy) diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/BranchConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/BranchConfiguration.cs index daaad30..762e65e 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/BranchConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/BranchConfiguration.cs @@ -23,7 +23,6 @@ public sealed class BranchConfiguration : IEntityTypeConfiguration .HasDefaultValue(EntityStatus.Active); builder.Property(b => b.CreatedAt).IsRequired(); - builder.Property(b => b.RowVersion).IsRowVersion(); builder.HasIndex(b => b.Status); } diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/BrandConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/BrandConfiguration.cs index 52724a8..186ef83 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/BrandConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/BrandConfiguration.cs @@ -21,9 +21,6 @@ public sealed class BrandConfiguration : IEntityTypeConfiguration builder.Property(b => b.CreatedAt).IsRequired(); - // PostgreSQL xmin system column as the optimistic concurrency token (ETag). - builder.Property(b => b.RowVersion).IsRowVersion(); - builder.HasIndex(b => b.Status); } } diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/BundleSaleConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/BundleSaleConfiguration.cs index d53b314..3d4b9bd 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/BundleSaleConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/BundleSaleConfiguration.cs @@ -27,11 +27,6 @@ public sealed class BundleSaleConfiguration : IEntityTypeConfiguration x.TaxTotal).HasPrecision(18, 4); builder.Property(x => x.GrandTotal).HasPrecision(18, 4); builder.Property(x => x.CreatedAt).IsRequired(); - builder.Property(x => x.ConcurrencyStamp) - .IsRequired() - .HasColumnType("integer") - .HasDefaultValue(0) - .IsConcurrencyToken(); builder.HasOne(x => x.Customer).WithMany().HasForeignKey(x => x.CustomerId).OnDelete(DeleteBehavior.Restrict); builder.HasOne(x => x.Warehouse).WithMany().HasForeignKey(x => x.WarehouseId).OnDelete(DeleteBehavior.Restrict); diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/BundleSaleTemplateConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/BundleSaleTemplateConfiguration.cs index e580e08..c6e4fd5 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/BundleSaleTemplateConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/BundleSaleTemplateConfiguration.cs @@ -20,11 +20,6 @@ public sealed class BundleSaleTemplateConfiguration : IEntityTypeConfiguration().HasMaxLength(20).IsRequired() .HasDefaultValue(EntityStatus.Active); builder.Property(x => x.CreatedAt).IsRequired(); - builder.Property(x => x.ConcurrencyStamp) - .IsRequired() - .HasColumnType("integer") - .HasDefaultValue(0) - .IsConcurrencyToken(); builder.HasMany(x => x.Lines) .WithOne(x => x.BundleSaleTemplate) diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/CategoryConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/CategoryConfiguration.cs index 8cc8732..aee9aa5 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/CategoryConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/CategoryConfiguration.cs @@ -21,9 +21,6 @@ public sealed class CategoryConfiguration : IEntityTypeConfiguration builder.Property(c => c.CreatedAt).IsRequired(); - // PostgreSQL xmin system column as the optimistic concurrency token (ETag). - builder.Property(c => c.RowVersion).IsRowVersion(); - builder.HasIndex(c => c.Status); } } diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/CustomerConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/CustomerConfiguration.cs index 9b3a8c8..2448444 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/CustomerConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/CustomerConfiguration.cs @@ -42,7 +42,6 @@ public sealed class CustomerConfiguration : IEntityTypeConfiguration .HasDefaultValue(EntityStatus.Active); builder.Property(c => c.CreatedAt).IsRequired(); - builder.Property(c => c.RowVersion).IsRowVersion(); builder.HasIndex(c => c.Status); builder.HasIndex(c => c.CustomerType); diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/DepartmentConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/DepartmentConfiguration.cs index dc51ed5..2285c17 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/DepartmentConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/DepartmentConfiguration.cs @@ -32,7 +32,6 @@ public sealed class DepartmentConfiguration : IEntityTypeConfiguration d.BranchId).OnDelete(DeleteBehavior.Restrict); builder.Property(d => d.CreatedAt).IsRequired(); - builder.Property(d => d.RowVersion).IsRowVersion(); builder.HasIndex(d => d.Status); builder.HasIndex(d => d.ParentDepartmentId); diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/DesignationConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/DesignationConfiguration.cs index f5255d8..1bc6f77 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/DesignationConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/DesignationConfiguration.cs @@ -21,7 +21,6 @@ public sealed class DesignationConfiguration : IEntityTypeConfiguration d.CreatedAt).IsRequired(); - builder.Property(d => d.RowVersion).IsRowVersion(); builder.HasIndex(d => d.Status); } diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/EmployeeBankDetailConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/EmployeeBankDetailConfiguration.cs index 35af1a9..b1e3607 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/EmployeeBankDetailConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/EmployeeBankDetailConfiguration.cs @@ -26,7 +26,6 @@ public sealed class EmployeeBankDetailConfiguration : IEntityTypeConfiguration b.EmployeeId).OnDelete(DeleteBehavior.Cascade); builder.Property(b => b.CreatedAt).IsRequired(); - builder.Property(b => b.RowVersion).IsRowVersion(); builder.HasIndex(b => b.EmployeeId); } diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/EmployeeConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/EmployeeConfiguration.cs index 08daa78..4ea703c 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/EmployeeConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/EmployeeConfiguration.cs @@ -63,7 +63,6 @@ public sealed class EmployeeConfiguration : IEntityTypeConfiguration .HasDefaultValue(EmployeeStatus.Active); builder.Property(e => e.CreatedAt).IsRequired(); - builder.Property(e => e.RowVersion).IsRowVersion(); builder.HasIndex(e => e.Status); builder.HasIndex(e => e.DepartmentId); diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/EmployeeDocumentConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/EmployeeDocumentConfiguration.cs index b75f6cb..2bd8ed4 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/EmployeeDocumentConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/EmployeeDocumentConfiguration.cs @@ -28,7 +28,6 @@ public sealed class EmployeeDocumentConfiguration : IEntityTypeConfiguration d.HrDocumentTypeId).OnDelete(DeleteBehavior.Restrict); builder.Property(d => d.UploadedAt).IsRequired(); - builder.Property(d => d.RowVersion).IsRowVersion(); builder.HasIndex(d => d.EmployeeId); builder.HasIndex(d => d.ExpiryDate); diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/EmployeeLoanConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/EmployeeLoanConfiguration.cs index 02dab41..9d51474 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/EmployeeLoanConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/EmployeeLoanConfiguration.cs @@ -28,7 +28,6 @@ public sealed class EmployeeLoanConfiguration : IEntityTypeConfiguration i.EmployeeLoanId).OnDelete(DeleteBehavior.Cascade); builder.Property(l => l.CreatedAt).IsRequired(); - builder.Property(l => l.RowVersion).IsRowVersion(); builder.HasIndex(l => l.EmployeeId); builder.HasIndex(l => l.Status); @@ -49,8 +48,6 @@ public sealed class LoanInstallmentConfiguration : IEntityTypeConfiguration i.PayrollRun).WithMany() .HasForeignKey(i => i.PayrollRunId).OnDelete(DeleteBehavior.Restrict); - builder.Property(i => i.RowVersion).IsRowVersion(); - builder.HasIndex(i => new { i.DueYear, i.DueMonth }); } } diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/EmployeeSalaryStructureConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/EmployeeSalaryStructureConfiguration.cs index 44aef27..28e718a 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/EmployeeSalaryStructureConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/EmployeeSalaryStructureConfiguration.cs @@ -22,7 +22,6 @@ public sealed class EmployeeSalaryStructureConfiguration : IEntityTypeConfigurat .HasForeignKey(l => l.EmployeeSalaryStructureId).OnDelete(DeleteBehavior.Cascade); builder.Property(s => s.CreatedAt).IsRequired(); - builder.Property(s => s.RowVersion).IsRowVersion(); builder.HasIndex(s => new { s.EmployeeId, s.EffectiveTo }); } diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/EmploymentTypeConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/EmploymentTypeConfiguration.cs index bd8eaef..5f2a1b8 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/EmploymentTypeConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/EmploymentTypeConfiguration.cs @@ -21,7 +21,6 @@ public sealed class EmploymentTypeConfiguration : IEntityTypeConfiguration e.CreatedAt).IsRequired(); - builder.Property(e => e.RowVersion).IsRowVersion(); builder.HasIndex(e => e.Status); } diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/GrnConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/GrnConfiguration.cs index b1c7a27..ea1c232 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/GrnConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/GrnConfiguration.cs @@ -17,7 +17,6 @@ public sealed class GrnConfiguration : IEntityTypeConfiguration builder.Property(g => g.Status).HasConversion().HasMaxLength(20).IsRequired(); builder.Property(g => g.CreatedAt).IsRequired(); builder.Property(g => g.GlJournalNo).HasMaxLength(30); - builder.Property(g => g.RowVersion).IsRowVersion(); builder.HasOne(g => g.PurchaseOrder).WithMany().HasForeignKey(g => g.PoId).OnDelete(DeleteBehavior.Restrict); builder.HasOne(g => g.Vendor).WithMany().HasForeignKey(g => g.VendorId).OnDelete(DeleteBehavior.Restrict); diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/HrDocumentTypeConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/HrDocumentTypeConfiguration.cs index 935afd4..2baebbf 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/HrDocumentTypeConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/HrDocumentTypeConfiguration.cs @@ -22,7 +22,6 @@ public sealed class HrDocumentTypeConfiguration : IEntityTypeConfiguration t.CreatedAt).IsRequired(); - builder.Property(t => t.RowVersion).IsRowVersion(); builder.HasIndex(t => t.Status); } diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/ItemConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/ItemConfiguration.cs index ada84e7..aaae131 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/ItemConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/ItemConfiguration.cs @@ -51,9 +51,6 @@ public sealed class ItemConfiguration : IEntityTypeConfiguration builder.Property(i => i.CreatedAt).IsRequired(); - // PostgreSQL xmin system column as the optimistic concurrency token (ETag). - builder.Property(i => i.RowVersion).IsRowVersion(); - builder.HasOne(i => i.Category) .WithMany() .HasForeignKey(i => i.CategoryId) diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/ItemTypeConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/ItemTypeConfiguration.cs index 4e9476a..acaced4 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/ItemTypeConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/ItemTypeConfiguration.cs @@ -30,9 +30,6 @@ public sealed class ItemTypeConfiguration : IEntityTypeConfiguration builder.Property(t => t.CreatedAt).IsRequired(); - // PostgreSQL xmin system column as the optimistic concurrency token (ETag). - builder.Property(t => t.RowVersion).IsRowVersion(); - builder.HasIndex(t => t.Status); } } diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/LeaveBalanceConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/LeaveBalanceConfiguration.cs index 093ff09..b7df251 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/LeaveBalanceConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/LeaveBalanceConfiguration.cs @@ -21,8 +21,6 @@ public sealed class LeaveBalanceConfiguration : IEntityTypeConfiguration b.LeaveType).WithMany() .HasForeignKey(b => b.LeaveTypeId).OnDelete(DeleteBehavior.Restrict); - builder.Property(b => b.RowVersion).IsRowVersion(); - builder.HasIndex(b => new { b.EmployeeId, b.LeaveTypeId, b.Year }).IsUnique(); } } diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/LeaveRequestConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/LeaveRequestConfiguration.cs index fe370c3..b317c12 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/LeaveRequestConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/LeaveRequestConfiguration.cs @@ -26,7 +26,6 @@ public sealed class LeaveRequestConfiguration : IEntityTypeConfiguration r.LeaveTypeId).OnDelete(DeleteBehavior.Restrict); builder.Property(r => r.CreatedAt).IsRequired(); - builder.Property(r => r.RowVersion).IsRowVersion(); builder.HasIndex(r => r.EmployeeId); builder.HasIndex(r => r.Status); diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/LeaveTypeConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/LeaveTypeConfiguration.cs index dec12cb..080cb44 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/LeaveTypeConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/LeaveTypeConfiguration.cs @@ -22,7 +22,6 @@ public sealed class LeaveTypeConfiguration : IEntityTypeConfiguration .HasDefaultValue(EntityStatus.Active); builder.Property(t => t.CreatedAt).IsRequired(); - builder.Property(t => t.RowVersion).IsRowVersion(); builder.HasIndex(t => t.Status); } diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/NotificationConfigConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/NotificationConfigConfiguration.cs index 710b1c5..0daa490 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/NotificationConfigConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/NotificationConfigConfiguration.cs @@ -9,13 +9,11 @@ public sealed class NotificationConfigConfiguration : IEntityTypeConfiguration builder) { builder.ToTable("notification_config", t => - t.HasCheckConstraint("ck_notification_config_singleton", $"\"NotificationConfigId\" = {NotificationConfig.SingletonId}")); + t.HasCheckConstraint("ck_notification_config_singleton", $"`NotificationConfigId` = {NotificationConfig.SingletonId}")); builder.HasKey(c => c.NotificationConfigId); builder.Property(c => c.NotificationConfigId).ValueGeneratedNever(); - builder.Property(c => c.RowVersion).IsRowVersion(); - builder.HasMany(c => c.Modules) .WithOne(m => m.NotificationConfig) .HasForeignKey(m => m.NotificationConfigId) diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/PayrollLineConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/PayrollLineConfiguration.cs index 56b62ee..c2785fc 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/PayrollLineConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/PayrollLineConfiguration.cs @@ -20,7 +20,7 @@ public sealed class PayrollLineConfiguration : IEntityTypeConfiguration l.Employee).WithMany() @@ -29,8 +29,6 @@ public sealed class PayrollLineConfiguration : IEntityTypeConfiguration l.Components).WithOne(c => c.PayrollLine!) .HasForeignKey(c => c.PayrollLineId).OnDelete(DeleteBehavior.Cascade); - builder.Property(l => l.RowVersion).IsRowVersion(); - builder.HasIndex(l => new { l.PayrollRunId, l.EmployeeId }).IsUnique(); } } diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/PayrollRunConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/PayrollRunConfiguration.cs index 4edc274..ae3a00b 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/PayrollRunConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/PayrollRunConfiguration.cs @@ -23,7 +23,6 @@ public sealed class PayrollRunConfiguration : IEntityTypeConfiguration l.PayrollRunId).OnDelete(DeleteBehavior.Cascade); builder.Property(r => r.GeneratedAt).IsRequired(); - builder.Property(r => r.RowVersion).IsRowVersion(); builder.HasIndex(r => new { r.PeriodYear, r.PeriodMonth, r.BranchId }); builder.HasIndex(r => r.Status); diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/PayrollStatutorySettingConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/PayrollStatutorySettingConfiguration.cs index 37da71e..f304632 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/PayrollStatutorySettingConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/PayrollStatutorySettingConfiguration.cs @@ -17,7 +17,6 @@ public sealed class PayrollStatutorySettingConfiguration : IEntityTypeConfigurat builder.Property(s => s.OtMultiplierDefault).HasPrecision(6, 2); builder.Property(s => s.CreatedAt).IsRequired(); - builder.Property(s => s.RowVersion).IsRowVersion(); builder.HasIndex(s => s.EffectiveFrom); } @@ -35,7 +34,6 @@ public sealed class TaxSlabConfiguration : IEntityTypeConfiguration builder.Property(s => s.Rate).HasPrecision(6, 4); builder.Property(s => s.CreatedAt).IsRequired(); - builder.Property(s => s.RowVersion).IsRowVersion(); builder.HasIndex(s => s.EffectiveFrom); } diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/ProductConfigConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/ProductConfigConfiguration.cs index e578af7..b7fcca9 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/ProductConfigConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/ProductConfigConfiguration.cs @@ -15,7 +15,7 @@ public sealed class ProductConfigConfiguration : IEntityTypeConfiguration - t.HasCheckConstraint("ck_product_config_singleton", $"\"ConfigId\" = {ProductConfig.SingletonId}")); + t.HasCheckConstraint("ck_product_config_singleton", $"`ConfigId` = {ProductConfig.SingletonId}")); builder.HasKey(c => c.ConfigId); @@ -32,6 +32,7 @@ public sealed class ProductConfigConfiguration : IEntityTypeConfiguration c.CustomVariantsEnabled).IsRequired().HasDefaultValue(false); builder.Property(c => c.ItemImagesEnabled).IsRequired().HasDefaultValue(false); builder.Property(c => c.CustomWarrantyPeriodsEnabled).IsRequired().HasDefaultValue(false); + // PostgreSQL xmin system column as the optimistic concurrency token (ETag). builder.Property(c => c.RowVersion).IsRowVersion(); diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/ProductionConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/ProductionConfiguration.cs index d7f6c42..98ffc7e 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/ProductionConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/ProductionConfiguration.cs @@ -32,13 +32,10 @@ public sealed class ProductionTemplateConfiguration : IEntityTypeConfiguration

t.Annotations).HasColumnType("jsonb"); + builder.Property(t => t.Annotations).HasColumnType("longtext"); builder.Property(t => t.CreatedAt).IsRequired(); - // PostgreSQL xmin system column as the optimistic concurrency token (ETag). - builder.Property(t => t.RowVersion).IsRowVersion(); - builder.HasOne(t => t.Creator).WithMany().HasForeignKey(t => t.CreatedBy).OnDelete(DeleteBehavior.Restrict); builder.HasIndex(t => t.Status); @@ -56,7 +53,7 @@ public sealed class TemplateStageConfiguration : IEntityTypeConfiguration s.RoleLabel).HasMaxLength(60); builder.Property(s => s.PosX).HasPrecision(18, 4); builder.Property(s => s.PosY).HasPrecision(18, 4); - builder.Property(s => s.FieldDefs).IsRequired().HasColumnType("jsonb"); + builder.Property(s => s.FieldDefs).IsRequired().HasColumnType("longtext"); builder.HasOne(s => s.Template).WithMany(t => t.Stages) .HasForeignKey(s => s.TemplateId).OnDelete(DeleteBehavior.Cascade); @@ -135,7 +132,6 @@ public sealed class ProductionRunConfiguration : IEntityTypeConfiguration r.ScaleFactor).HasPrecision(18, 6); builder.Property(r => r.Status).HasConversion().HasMaxLength(20).IsRequired(); builder.Property(r => r.CreatedAt).IsRequired(); - builder.Property(r => r.RowVersion).IsRowVersion(); builder.HasOne(r => r.Template).WithMany(t => t.Runs) .HasForeignKey(r => r.TemplateId).OnDelete(DeleteBehavior.Restrict); @@ -162,9 +158,8 @@ public sealed class RunStageConfiguration : IEntityTypeConfiguration builder.Property(s => s.PosX).HasPrecision(18, 4); builder.Property(s => s.PosY).HasPrecision(18, 4); builder.Property(s => s.Status).HasConversion().HasMaxLength(20).IsRequired(); - builder.Property(s => s.FieldDefs).IsRequired().HasColumnType("jsonb"); - builder.Property(s => s.FieldValues).HasColumnType("jsonb"); - builder.Property(s => s.RowVersion).IsRowVersion(); + builder.Property(s => s.FieldDefs).IsRequired().HasColumnType("longtext"); + builder.Property(s => s.FieldValues).HasColumnType("longtext"); builder.HasOne(s => s.Run).WithMany(r => r.Stages) .HasForeignKey(s => s.RunId).OnDelete(DeleteBehavior.Cascade); @@ -258,7 +253,7 @@ public sealed class RunStageEventConfiguration : IEntityTypeConfiguration e.EventType).HasConversion().HasMaxLength(20).IsRequired(); builder.Property(e => e.Note).HasMaxLength(500); - builder.Property(e => e.Payload).HasColumnType("jsonb"); + builder.Property(e => e.Payload).HasColumnType("longtext"); builder.Property(e => e.CreatedAt).IsRequired(); builder.HasOne(e => e.Run).WithMany(r => r.Events) diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/PurchaseInvoiceConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/PurchaseInvoiceConfiguration.cs index d27e917..aed6435 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/PurchaseInvoiceConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/PurchaseInvoiceConfiguration.cs @@ -40,7 +40,6 @@ public sealed class PurchaseInvoiceConfiguration : IEntityTypeConfiguration x.Creator).WithMany().HasForeignKey(x => x.CreatedBy).OnDelete(DeleteBehavior.Restrict); builder.Property(x => x.CreatedAt).IsRequired(); - builder.Property(x => x.RowVersion).IsRowVersion(); builder.HasIndex(x => x.Status); builder.HasIndex(x => x.VendorId); diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/PurchaseOrderConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/PurchaseOrderConfiguration.cs index 9aa8588..a03acfc 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/PurchaseOrderConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/PurchaseOrderConfiguration.cs @@ -18,9 +18,6 @@ public sealed class PurchaseOrderConfiguration : IEntityTypeConfiguration().HasMaxLength(20).IsRequired(); builder.Property(p => p.CreatedAt).IsRequired(); - // PostgreSQL xmin system column as the optimistic concurrency token (ETag). - builder.Property(p => p.RowVersion).IsRowVersion(); - builder.HasOne(p => p.Vendor) .WithMany() .HasForeignKey(p => p.VendorId) diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/RoleConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/RoleConfiguration.cs index dcf2712..6d4ce86 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/RoleConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/RoleConfiguration.cs @@ -27,7 +27,5 @@ public sealed class RoleConfiguration : IEntityTypeConfiguration builder.Property(r => r.CreatedAt).IsRequired(); - // PostgreSQL xmin system column as the optimistic concurrency token (ETag). - builder.Property(r => r.RowVersion).IsRowVersion(); } } diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/SalaryComponentConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/SalaryComponentConfiguration.cs index b67800c..c25ec4e 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/SalaryComponentConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/SalaryComponentConfiguration.cs @@ -22,7 +22,6 @@ public sealed class SalaryComponentConfiguration : IEntityTypeConfiguration c.CreatedAt).IsRequired(); - builder.Property(c => c.RowVersion).IsRowVersion(); builder.HasIndex(c => c.Status); } diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/SalesDayEndConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/SalesDayEndConfiguration.cs index 301cfc7..d120f62 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/SalesDayEndConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/SalesDayEndConfiguration.cs @@ -25,7 +25,6 @@ public sealed class SalesDayEndConfiguration : IEntityTypeConfiguration x.GlJournalNo).HasMaxLength(30); builder.Property(x => x.ClosedAt).IsRequired(); - builder.Property(x => x.RowVersion).IsRowVersion(); builder.HasOne(x => x.CashierUser).WithMany().HasForeignKey(x => x.CashierUserId).OnDelete(DeleteBehavior.Restrict); builder.HasOne(x => x.ClosedByUser).WithMany().HasForeignKey(x => x.ClosedBy).OnDelete(DeleteBehavior.Restrict); diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/SalesInvoiceConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/SalesInvoiceConfiguration.cs index 7f20c4b..f759bdc 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/SalesInvoiceConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/SalesInvoiceConfiguration.cs @@ -48,7 +48,6 @@ public sealed class SalesInvoiceConfiguration : IEntityTypeConfiguration x.GlJournalNo).HasMaxLength(30); builder.Property(x => x.CreatedAt).IsRequired(); - builder.Property(x => x.RowVersion).IsRowVersion(); builder.HasIndex(x => x.Status); builder.HasIndex(x => x.InvoiceDate); @@ -113,6 +112,5 @@ public sealed class SalesInvoiceLineConfiguration : IEntityTypeConfiguration x.PriceSource).HasMaxLength(50); - builder.Property(x => x.RowVersion).IsRowVersion(); } } diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/SalesSlipConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/SalesSlipConfiguration.cs index d86c132..73e8184 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/SalesSlipConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/SalesSlipConfiguration.cs @@ -42,7 +42,6 @@ public sealed class SalesSlipConfiguration : IEntityTypeConfiguration builder.Property(p).HasPrecision(18, 4); builder.Property(x => x.CreatedAt).IsRequired(); - builder.Property(x => x.RowVersion).IsRowVersion(); builder.HasIndex(x => x.Status); builder.HasIndex(x => x.SlipDate); @@ -95,6 +94,5 @@ public sealed class SalesSlipLineConfiguration : IEntityTypeConfiguration x.PriceSource).HasMaxLength(50); - builder.Property(x => x.RowVersion).IsRowVersion(); } } diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/StockAdjustmentConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/StockAdjustmentConfiguration.cs index 1a05216..549b0af 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/StockAdjustmentConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/StockAdjustmentConfiguration.cs @@ -17,7 +17,6 @@ public sealed class StockAdjustmentConfiguration : IEntityTypeConfiguration a.Status).HasConversion().HasMaxLength(20).IsRequired(); builder.Property(a => a.CreatedAt).IsRequired(); builder.Property(a => a.GlJournalNo).HasMaxLength(30); - builder.Property(a => a.RowVersion).IsRowVersion(); builder.HasOne(a => a.Warehouse).WithMany().HasForeignKey(a => a.WarehouseId).OnDelete(DeleteBehavior.Restrict); builder.HasOne(a => a.ReasonCode).WithMany().HasForeignKey(a => a.ReasonCodeId).OnDelete(DeleteBehavior.Restrict); diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/StockCountConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/StockCountConfiguration.cs index 9f8b870..21ce9dd 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/StockCountConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/StockCountConfiguration.cs @@ -17,7 +17,6 @@ public sealed class StockCountConfiguration : IEntityTypeConfiguration c.CountType).HasConversion().HasMaxLength(20).IsRequired(); builder.Property(c => c.Status).HasConversion().HasMaxLength(20).IsRequired(); builder.Property(c => c.CreatedAt).IsRequired(); - builder.Property(c => c.RowVersion).IsRowVersion(); builder.HasOne(c => c.Warehouse).WithMany().HasForeignKey(c => c.WarehouseId).OnDelete(DeleteBehavior.Restrict); builder.HasOne(c => c.Branch).WithMany().HasForeignKey(c => c.BranchId).OnDelete(DeleteBehavior.Restrict); diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/StockTransferConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/StockTransferConfiguration.cs index 24f5440..92ad2fc 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/StockTransferConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/StockTransferConfiguration.cs @@ -16,7 +16,6 @@ public sealed class StockTransferConfiguration : IEntityTypeConfiguration t.Status).HasConversion().HasMaxLength(20).IsRequired(); builder.Property(t => t.CreatedAt).IsRequired(); - builder.Property(t => t.RowVersion).IsRowVersion(); builder.HasOne(t => t.SrcWarehouse).WithMany().HasForeignKey(t => t.SrcWarehouseId).OnDelete(DeleteBehavior.Restrict); builder.HasOne(t => t.DestWarehouse).WithMany().HasForeignKey(t => t.DestWarehouseId).OnDelete(DeleteBehavior.Restrict); diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/SubCategoryConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/SubCategoryConfiguration.cs index 9fadd72..208b064 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/SubCategoryConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/SubCategoryConfiguration.cs @@ -20,9 +20,6 @@ public sealed class SubCategoryConfiguration : IEntityTypeConfiguration s.CreatedAt).IsRequired(); - // PostgreSQL xmin system column as the optimistic concurrency token (ETag). - builder.Property(s => s.RowVersion).IsRowVersion(); - builder.HasOne(s => s.Category) .WithMany(c => c.SubCategories) .HasForeignKey(s => s.CategoryId) diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/SupportTicketConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/SupportTicketConfiguration.cs index acb4feb..5e5b245 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/SupportTicketConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/SupportTicketConfiguration.cs @@ -13,7 +13,6 @@ public sealed class SupportTicketConfiguration : IEntityTypeConfiguration t.Subject).IsRequired().HasMaxLength(200); builder.Property(t => t.Status).IsRequired().HasConversion().HasMaxLength(20); - builder.Property(t => t.RowVersion).IsRowVersion(); builder.HasIndex(t => t.CreatedBy); builder.HasIndex(t => t.Status); diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/TaxRateConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/TaxRateConfiguration.cs index 1c75659..909ccdf 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/TaxRateConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/TaxRateConfiguration.cs @@ -24,9 +24,6 @@ public sealed class TaxRateConfiguration : IEntityTypeConfiguration builder.Property(t => t.CreatedAt).IsRequired(); - // PostgreSQL xmin system column as the optimistic concurrency token (ETag). - builder.Property(t => t.RowVersion).IsRowVersion(); - builder.HasIndex(t => t.Status); // Seeded so Item.TaxRateId has something real to point at immediately — codes @@ -34,9 +31,9 @@ public sealed class TaxRateConfiguration : IEntityTypeConfiguration // afterward (percentages are typically jurisdiction-specific). var seededAt = new DateTime(2026, 1, 1, 0, 0, 0, DateTimeKind.Utc); builder.HasData( - new TaxRate { TaxRateId = 1, Code = "STANDARD", Name = "Standard", Percentage = 15m, CreatedAt = seededAt }, - new TaxRate { TaxRateId = 2, Code = "ZERO", Name = "Zero-Rated", Percentage = 0m, CreatedAt = seededAt }, - new TaxRate { TaxRateId = 3, Code = "EXEMPT", Name = "Exempt", Percentage = 0m, CreatedAt = seededAt } + new TaxRate { TaxRateId = 1, Code = "STANDARD", Name = "Standard", Percentage = 15m, CreatedAt = seededAt, RowVersion = 1 }, + new TaxRate { TaxRateId = 2, Code = "ZERO", Name = "Zero-Rated", Percentage = 0m, CreatedAt = seededAt, RowVersion = 1 }, + new TaxRate { TaxRateId = 3, Code = "EXEMPT", Name = "Exempt", Percentage = 0m, CreatedAt = seededAt, RowVersion = 1 } ); } } diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/VendorConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/VendorConfiguration.cs index 3dc19b5..2e9ca34 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/VendorConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/VendorConfiguration.cs @@ -26,9 +26,6 @@ public sealed class VendorConfiguration : IEntityTypeConfiguration builder.Property(v => v.CreatedAt).IsRequired(); - // PostgreSQL xmin system column as the optimistic concurrency token (ETag). - builder.Property(v => v.RowVersion).IsRowVersion(); - builder.HasIndex(v => v.Status); builder.HasOne(v => v.Branch).WithMany() diff --git a/Backend/ERPCore/Infra/Persistence/Configurations/WorkShiftConfiguration.cs b/Backend/ERPCore/Infra/Persistence/Configurations/WorkShiftConfiguration.cs index 8c8e68e..94f968c 100644 --- a/Backend/ERPCore/Infra/Persistence/Configurations/WorkShiftConfiguration.cs +++ b/Backend/ERPCore/Infra/Persistence/Configurations/WorkShiftConfiguration.cs @@ -22,7 +22,6 @@ public sealed class WorkShiftConfiguration : IEntityTypeConfiguration .HasDefaultValue(EntityStatus.Active); builder.Property(w => w.CreatedAt).IsRequired(); - builder.Property(w => w.RowVersion).IsRowVersion(); builder.HasIndex(w => w.Status); } diff --git a/Backend/ERPCore/Infra/Persistence/DataSeeder.cs b/Backend/ERPCore/Infra/Persistence/DataSeeder.cs index 38cbf9d..49c358c 100644 --- a/Backend/ERPCore/Infra/Persistence/DataSeeder.cs +++ b/Backend/ERPCore/Infra/Persistence/DataSeeder.cs @@ -1,15 +1,23 @@ using ERPCore.Domain.Entities; -using ERPCore.Domain; using ERPCore.Domain.Enums; using Microsoft.EntityFrameworkCore; namespace ERPCore.Infra.Persistence; ///

-/// Idempotent startup seeding of configurable reference data (docs/10 §B.8.3). -/// Reason codes are seeded at runtime (not via HasData) so the identity -/// sequence advances normally and later admin POST /reason-codes calls -/// cannot collide with seeded ids. +/// Idempotent startup seeding of the reference data the application cannot run without +/// (docs/10 §B.8.3): the default branch, reason codes, item types, and the three singleton +/// config rows. Navigation items, sub-nav items, permissions, tax rates and the `system` +/// user come from HasData in Infra/Persistence/Configurations instead, so the +/// baseline migration emits them as InsertData. +/// +/// Reason codes are seeded at runtime (not via HasData) so the identity sequence +/// advances normally and later admin POST /reason-codes calls cannot collide with +/// seeded ids. +/// +/// Demo/sample data (warehouses MAIN/SHOP, UOMs, categories, demo items, fabricated stock +/// layers, sample invoices/slips, bundle sales) was removed with the MySQL port: a fresh +/// database is now production-shaped. The e2e suite creates whatever fixtures it needs. /// public static class DataSeeder { @@ -41,21 +49,57 @@ public static class DataSeeder public static async Task SeedAsync(ErpDbContext db, CancellationToken ct = default) { + // Must come first, and must save on its own: every branch-scoped entity has a + // non-nullable BranchId with a Restrict FK, so nothing branch-scoped can be written + // until this row has a real generated id. + await EnsureDefaultBranchAsync(db, ct); + var dirty = await SeedReasonCodesAsync(db, ct); dirty |= await SeedItemTypesAsync(db, ct); - // dirty |= await SeedCompanyProfileAsync(db, ct); dirty |= await SeedProductConfigAsync(db, ct); dirty |= await SeedBranchConfigAsync(db, ct); dirty |= await SeedSalesConfigAsync(db, ct); dirty |= await SeedGrnConfigAsync(db, ct); dirty |= await SeedNotificationConfigAsync(db, ct); - dirty |= await SeedSalesMastersAsync(db, ct); - dirty |= await SeedSalesStockAsync(db, ct); - dirty |= await SeedSalesAsync(db, ct); if (dirty) await db.SaveChangesAsync(ct); } + /// + /// Creates the deployment's default branch () if absent. + /// + /// + /// Before the MySQL port this row was inserted by raw SQL inside the BranchIsolationPhase1 + /// migration, which the squash to a single baseline deleted — so on a genuinely fresh + /// database there would be no branch at all and the first branch-scoped insert would fail + /// on the FK. It is deliberately NOT HasData: branches are user-editable business + /// data, and an admin renaming this one through the UI would become permanent model drift + /// that EF tries to "correct" on the next migration. + /// + /// keeps its lazy + /// create as the runtime fallback, but seeding here means it never has to fire mid-request + /// (where it would do a nested SaveChanges inside a caller's UoW transaction). + /// + private static async Task EnsureDefaultBranchAsync(ErpDbContext db, CancellationToken ct) + { + var existingId = await db.Branches.AsNoTracking() + .Where(b => b.Code == Branch.DefaultCode) + .Select(b => b.BranchId) + .FirstOrDefaultAsync(ct); + if (existingId != 0) return existingId; + + var branch = new Branch + { + Code = Branch.DefaultCode, + Name = Branch.DefaultName, + Status = EntityStatus.Active, + CreatedAt = DateTime.UtcNow + }; + db.Branches.Add(branch); + await db.SaveChangesAsync(ct); + return branch.BranchId; + } + private static async Task SeedReasonCodesAsync(ErpDbContext db, CancellationToken ct) { var existing = await db.ReasonCodes @@ -165,747 +209,4 @@ public static class DataSeeder }); return true; } - - /// - /// Seeds a printable company profile with reasonable defaults for invoice headers. - /// These values are intentionally editable later through the API. - /// - //private static async Task SeedCompanyProfileAsync(ErpDbContext db, CancellationToken ct) - //{ - // if (await db.CompanyProfiles.AnyAsync(c => c.CompanyProfileId == CompanyProfile.SingletonId, ct)) return false; - - // db.CompanyProfiles.Add(new CompanyProfile - // { - // CompanyProfileId = CompanyProfile.SingletonId, - // LegalName = "ERP Core Trading (Pvt) Ltd", - // TradeName = "ERP Core Trading", - // TaxRegistrationNo = "TAX-DEFAULT-001", - // VatRegistrationNo = "VAT-DEFAULT-001", - // AddressLine1 = "1 Demo Street", - // City = "Colombo", - // Country = "Sri Lanka", - // Phone = "+94 11 000 0000", - // Email = "accounts@example.com", - // BankName = "Demo Bank", - // BankBranch = "Colombo Main", - // AccountName = "ERP Core Trading (Pvt) Ltd", - // AccountNumber = "000123456789", - // SwiftCode = "DEMO1234", - // FooterNote = "Thank you for your business." - // }); - // return true; - //} - - /// - /// Seeds the minimum catalog data required for the sales demo rows to exist. - /// These are safe additive rows and do not alter any existing data. - /// - private static async Task SeedSalesMastersAsync(ErpDbContext db, CancellationToken ct) - { - var dirty = false; - - dirty |= await SeedWarehousesAsync(db, ct); - dirty |= await SeedUomsAsync(db, ct); - dirty |= await SeedCategoriesAsync(db, ct); - dirty |= await SeedItemsAsync(db, ct); - - return dirty; - } - - /// - /// Seeds a simple on-hand FIFO layer for the demo sales item so the sample - /// invoices can be posted without immediately failing stock validation. - /// This keeps the stock-check and posting flows testable on a fresh database. - /// - private static async Task SeedSalesStockAsync(ErpDbContext db, CancellationToken ct) - { - var warehouse = await db.Warehouses.AsNoTracking() - .OrderBy(w => w.WarehouseId) - .FirstOrDefaultAsync(ct); - var item = await db.Items.AsNoTracking() - .OrderBy(i => i.ItemId) - .FirstOrDefaultAsync(ct); - var secondItem = await db.Items.AsNoTracking() - .OrderByDescending(i => i.ItemId) - .FirstOrDefaultAsync(ct); - - if (warehouse is null || item is null || secondItem is null) - return false; - - var existing = await db.StockLayers.AnyAsync( - l => (l.ItemId == item.ItemId || l.ItemId == secondItem.ItemId) && l.WarehouseId == warehouse.WarehouseId && l.QtyRemaining > 0m, - ct); - if (existing) return false; - - db.StockLayers.Add(new StockLayer - { - ItemId = item.ItemId, - WarehouseId = warehouse.WarehouseId, - QtyReceived = 100m, - QtyRemaining = 100m, - UnitCost = item.SellingFlatPrice.GetValueOrDefault() > 0m ? item.SellingFlatPrice.GetValueOrDefault() / 2m : 25m, - ReceiptDate = DateTime.UtcNow.AddDays(-7) - }); - db.StockLayers.Add(new StockLayer - { - ItemId = secondItem.ItemId, - WarehouseId = warehouse.WarehouseId, - QtyReceived = 5m, - QtyRemaining = 5m, - UnitCost = secondItem.SellingFlatPrice.GetValueOrDefault() > 0m ? secondItem.SellingFlatPrice.GetValueOrDefault() / 2m : 15m, - ReceiptDate = DateTime.UtcNow.AddDays(-6) - }); - return true; - } - - private static async Task SeedWarehousesAsync(ErpDbContext db, CancellationToken ct) - { - var existingCodes = await db.Warehouses.Select(w => w.Code).ToListAsync(ct); - var have = existingCodes.ToHashSet(StringComparer.OrdinalIgnoreCase); - - var seeds = new[] - { - new Warehouse { Code = "MAIN", Name = "Main Warehouse" }, - new Warehouse { Code = "SHOP", Name = "Sales Counter" } - }; - - var toAdd = seeds.Where(w => !have.Contains(w.Code)).ToList(); - if (toAdd.Count == 0) return false; - - db.Warehouses.AddRange(toAdd); - return true; - } - - private static async Task SeedUomsAsync(ErpDbContext db, CancellationToken ct) - { - var existingNames = await db.Uoms.Select(u => u.Name).ToListAsync(ct); - var have = existingNames.ToHashSet(StringComparer.OrdinalIgnoreCase); - - var seeds = new[] - { - new Uom { Name = "PCS" }, - new Uom { Name = "BOX" } - }; - - var toAdd = seeds.Where(u => !have.Contains(u.Name)).ToList(); - if (toAdd.Count == 0) return false; - - db.Uoms.AddRange(toAdd); - return true; - } - - private static async Task SeedCategoriesAsync(ErpDbContext db, CancellationToken ct) - { - var existingNames = await db.Categories.Select(c => c.Name).ToListAsync(ct); - var have = existingNames.ToHashSet(StringComparer.OrdinalIgnoreCase); - - var seeds = new[] - { - new Category { Name = "General Goods", Status = EntityStatus.Active, CreatedAt = DateTime.UtcNow }, - new Category { Name = "Accessories", Status = EntityStatus.Active, CreatedAt = DateTime.UtcNow } - }; - - var toAdd = seeds.Where(c => !have.Contains(c.Name)).ToList(); - if (toAdd.Count == 0) return false; - - db.Categories.AddRange(toAdd); - return true; - } - - private static async Task SeedItemsAsync(ErpDbContext db, CancellationToken ct) - { - var existingSkus = await db.Items.Select(i => i.Sku).ToListAsync(ct); - var have = existingSkus.ToHashSet(StringComparer.OrdinalIgnoreCase); - - var category = await db.Categories.AsNoTracking() - .OrderBy(c => c.CategoryId) - .FirstOrDefaultAsync(ct); - var uom = await db.Uoms.AsNoTracking() - .OrderBy(u => u.UomId) - .FirstOrDefaultAsync(ct); - - if (category is null || uom is null) - return false; - - var now = DateTime.UtcNow; - var seeds = new[] - { - new Item - { - Sku = "SKU-DEMO-001", - Name = "Demo Item 1", - Description = "Seeded sample item for sales documents", - CategoryId = category.CategoryId, - BaseUomId = uom.UomId, - StockNature = StockNature.Stocked, - TrackingMode = TrackingMode.None, - SellingFlatPrice = 100m, - Status = EntityStatus.Active, - CreatedAt = now - }, - new Item - { - Sku = "SKU-DEMO-002", - Name = "Demo Item 2 (500 ml)", - Description = "Secondary seeded sample item; carries a content size so the " - + "production content-unit path has a fixture", - CategoryId = category.CategoryId, - BaseUomId = uom.UomId, - StockNature = StockNature.Stocked, - TrackingMode = TrackingMode.None, - SellingFlatPrice = 50m, - ContentQty = 500m, - ContentUnit = MeasureUnit.Ml, - ContentBaseQty = 500m, - ContentBaseUnit = MeasureUnit.Ml, - Status = EntityStatus.Active, - CreatedAt = now - } - }; - - var toAdd = seeds.Where(i => !have.Contains(i.Sku)).ToList(); - if (toAdd.Count == 0) return false; - - db.Items.AddRange(toAdd); - return true; - } - - /// - /// Seeds the minimum sales bootstrap data needed for UI/backend development: - /// a couple of customer rows, current-year document counters, and a few draft - /// invoice/slip samples when the required master data already exists. - /// This intentionally never clears or rewrites any existing rows. - /// - private static async Task SeedSalesAsync(ErpDbContext db, CancellationToken ct) - { - var dirty = false; - - dirty |= await SeedSalesCustomersAsync(db, ct); - dirty |= await SeedSalesSequencesAsync(db, ct); - dirty |= await SeedSampleSalesDocsAsync(db, ct); - - try - { - dirty |= await SeedBundleSalesAsync(db, ct); - } - catch - { - // Bundle demo data is best-effort only; never block startup because of seed drift. - } - - return dirty; - } - - private static async Task SeedSalesCustomersAsync(ErpDbContext db, CancellationToken ct) - { - var existingCodes = await db.Customers.Select(c => c.CustomerCode).ToListAsync(ct); - var have = existingCodes.ToHashSet(StringComparer.OrdinalIgnoreCase); - - var seeds = new[] - { - new Customer - { - CustomerCode = "CUST-WALKIN", - CustomerType = CustomerType.B2C, - Name = "Walk-in Customer", - DisplayName = "Walk-in Customer", - CreditLimit = 0m, - CreditDays = 0, - Status = EntityStatus.Active, - CreatedAt = DateTime.UtcNow - }, - new Customer - { - CustomerCode = "CUST-DEMO", - CustomerType = CustomerType.B2B, - Name = "Demo Retail Ltd", - DisplayName = "Demo Retail Ltd", - Phone = "+94 11 000 0000", - Email = "sales@example.com", - AddressLine1 = "1 Demo Street", - City = "Colombo", - Country = "Sri Lanka", - TaxRegistrationNo = "VAT-DEMO-001", - CreditLimit = 250000m, - CreditDays = 30, - Status = EntityStatus.Active, - CreatedAt = DateTime.UtcNow - } - }; - - var toAdd = seeds.Where(c => !have.Contains(c.CustomerCode)).ToList(); - if (toAdd.Count == 0) return false; - - db.Customers.AddRange(toAdd); - return true; - } - - private static async Task SeedSalesSequencesAsync(ErpDbContext db, CancellationToken ct) - { - var year = DateTime.UtcNow.Year; - var existing = await db.NumberSequences - .Where(s => s.Year == year && (s.DocType == DocumentTypes.SalesInvoice || s.DocType == DocumentTypes.SalesSlip || s.DocType == DocumentTypes.BundleSale)) - .Select(s => s.DocType) - .ToListAsync(ct); - var have = existing.ToHashSet(StringComparer.OrdinalIgnoreCase); - - var seeds = new[] - { - new NumberSequence { DocType = DocumentTypes.SalesInvoice, Year = year, LastNumber = 0 }, - new NumberSequence { DocType = DocumentTypes.SalesSlip, Year = year, LastNumber = 0 }, - new NumberSequence { DocType = DocumentTypes.BundleSale, Year = year, LastNumber = 0 } - }; - - var toAdd = seeds.Where(s => !have.Contains(s.DocType)).ToList(); - if (toAdd.Count == 0) return false; - - db.NumberSequences.AddRange(toAdd); - return true; - } - - private static async Task SeedBundleSalesAsync(ErpDbContext db, CancellationToken ct) - { - if (await db.BundleSaleTemplates.AnyAsync(ct) || await db.BundleSales.AnyAsync(ct)) - return false; - - var customer = await db.Customers.AsNoTracking() - .OrderBy(c => c.CustomerId) - .FirstOrDefaultAsync(ct); - var warehouse = await db.Warehouses.AsNoTracking() - .OrderBy(w => w.WarehouseId) - .FirstOrDefaultAsync(ct); - var secondaryWarehouse = await db.Warehouses.AsNoTracking() - .OrderByDescending(w => w.WarehouseId) - .FirstOrDefaultAsync(ct); - var items = await db.Items.AsNoTracking() - .OrderBy(i => i.ItemId) - .Take(2) - .ToListAsync(ct); - var uom = await db.Uoms.AsNoTracking() - .OrderBy(u => u.UomId) - .FirstOrDefaultAsync(ct); - var user = await db.Users.AsNoTracking() - .OrderBy(u => u.UserId) - .FirstOrDefaultAsync(ct); - - if (customer is null || warehouse is null || secondaryWarehouse is null || items.Count < 2 || uom is null || user is null) - return false; - - var now = DateTime.UtcNow; - var template = new BundleSaleTemplate - { - TemplateCode = "BND-DEMO-001", - TemplateName = "Demo Bundle Pack", - Description = "Seeded fixed bundle template for integration testing", - Status = EntityStatus.Active, - CreatedAt = now, - Lines = - [ - new BundleSaleTemplateLine - { - ItemId = items[0].ItemId, - WarehouseId = warehouse.WarehouseId, - Qty = 1m, - UnitPrice = items[0].SellingFlatPrice.GetValueOrDefault(), - IncludeInBundle = true, - SortOrder = 1 - }, - new BundleSaleTemplateLine - { - ItemId = items[1].ItemId, - WarehouseId = warehouse.WarehouseId, - Qty = 1m, - UnitPrice = items[1].SellingFlatPrice.GetValueOrDefault(), - IncludeInBundle = true, - SortOrder = 2 - } - ] - }; - - db.BundleSaleTemplates.Add(template); - await db.SaveChangesAsync(ct); - - var bundleSales = new[] - { - new BundleSale - { - BundleNo = $"BND-{now:yyyy}-00001", - BundleDate = now.Date.AddDays(-2), - CustomerId = customer.CustomerId, - CustomerSnapshotName = customer.DisplayName ?? customer.Name, - WarehouseId = warehouse.WarehouseId, - CashierUserId = user.UserId, - BundleSaleTemplateId = template.BundleSaleTemplateId, - BundleName = "Demo Bundle Draft", - BundleCode = "BND-DEMO-001", - Status = BundleSaleStatus.Draft, - ComponentSubtotal = items[0].SellingFlatPrice.GetValueOrDefault() + items[1].SellingFlatPrice.GetValueOrDefault(), - BundlePrice = 0m, - MarginAmount = -(items[0].SellingFlatPrice.GetValueOrDefault() + items[1].SellingFlatPrice.GetValueOrDefault()), - DiscountTotal = items[0].SellingFlatPrice.GetValueOrDefault() + items[1].SellingFlatPrice.GetValueOrDefault(), - TaxTotal = 0m, - GrandTotal = 0m, - CreatedAt = now.AddDays(-2), - Lines = - [ - new BundleSaleLine - { - ItemId = items[0].ItemId, - Description = items[0].Name, - Qty = 1m, - WarehouseId = warehouse.WarehouseId, - UnitPrice = items[0].SellingFlatPrice.GetValueOrDefault(), - LineTotal = items[0].SellingFlatPrice.GetValueOrDefault(), - IncludeInBundle = true, - IsComponent = true - }, - new BundleSaleLine - { - ItemId = items[1].ItemId, - Description = items[1].Name, - Qty = 1m, - WarehouseId = warehouse.WarehouseId, - UnitPrice = items[1].SellingFlatPrice.GetValueOrDefault(), - LineTotal = items[1].SellingFlatPrice.GetValueOrDefault(), - IncludeInBundle = true, - IsComponent = true - } - ] - }, - new BundleSale - { - BundleNo = $"BND-{now:yyyy}-00002", - BundleDate = now.Date.AddDays(-1), - CustomerId = customer.CustomerId, - CustomerSnapshotName = customer.DisplayName ?? customer.Name, - WarehouseId = warehouse.WarehouseId, - CashierUserId = user.UserId, - BundleSaleTemplateId = template.BundleSaleTemplateId, - BundleName = "Demo Bundle Posted", - BundleCode = "BND-DEMO-001", - Status = BundleSaleStatus.Posted, - ComponentSubtotal = items[0].SellingFlatPrice.GetValueOrDefault() + items[1].SellingFlatPrice.GetValueOrDefault(), - BundlePrice = (items[0].SellingFlatPrice.GetValueOrDefault() + items[1].SellingFlatPrice.GetValueOrDefault()) - 10m, - MarginAmount = -10m, - DiscountTotal = 10m, - TaxTotal = 0m, - GrandTotal = (items[0].SellingFlatPrice.GetValueOrDefault() + items[1].SellingFlatPrice.GetValueOrDefault()) - 10m, - CreatedAt = now.AddDays(-1), - UpdatedAt = now.AddHours(-2), - Lines = - [ - new BundleSaleLine - { - ItemId = items[0].ItemId, - Description = items[0].Name, - Qty = 1m, - WarehouseId = warehouse.WarehouseId, - UnitPrice = items[0].SellingFlatPrice.GetValueOrDefault(), - LineTotal = items[0].SellingFlatPrice.GetValueOrDefault(), - IncludeInBundle = true, - IsComponent = true - }, - new BundleSaleLine - { - ItemId = items[1].ItemId, - Description = items[1].Name, - Qty = 1m, - WarehouseId = warehouse.WarehouseId, - UnitPrice = items[1].SellingFlatPrice.GetValueOrDefault(), - LineTotal = items[1].SellingFlatPrice.GetValueOrDefault(), - IncludeInBundle = true, - IsComponent = true - } - ] - }, - new BundleSale - { - BundleNo = $"BND-{now:yyyy}-00003", - BundleDate = now.Date, - CustomerId = customer.CustomerId, - CustomerSnapshotName = customer.DisplayName ?? customer.Name, - WarehouseId = secondaryWarehouse.WarehouseId, - CashierUserId = user.UserId, - BundleSaleTemplateId = template.BundleSaleTemplateId, - BundleName = "Demo Bundle Cancelled", - BundleCode = "BND-DEMO-001", - Status = BundleSaleStatus.Cancelled, - ComponentSubtotal = items[0].SellingFlatPrice.GetValueOrDefault(), - BundlePrice = items[0].SellingFlatPrice.GetValueOrDefault(), - MarginAmount = 0m, - DiscountTotal = 0m, - TaxTotal = 0m, - GrandTotal = items[0].SellingFlatPrice.GetValueOrDefault(), - CreatedAt = now, - UpdatedAt = now, - Lines = - [ - new BundleSaleLine - { - ItemId = items[0].ItemId, - Description = items[0].Name, - Qty = 1m, - WarehouseId = secondaryWarehouse.WarehouseId, - UnitPrice = items[0].SellingFlatPrice.GetValueOrDefault(), - LineTotal = items[0].SellingFlatPrice.GetValueOrDefault(), - IncludeInBundle = true, - IsComponent = true - } - ] - } - }; - - db.BundleSales.AddRange(bundleSales); - return true; - } - - private static async Task SeedSampleSalesDocsAsync(ErpDbContext db, CancellationToken ct) - { - if (await db.SalesInvoices.AnyAsync(ct) || await db.SalesSlips.AnyAsync(ct)) - return false; - - var customer = await db.Customers.AsNoTracking() - .OrderBy(c => c.CustomerId) - .FirstOrDefaultAsync(ct); - var warehouse = await db.Warehouses.AsNoTracking() - .OrderBy(w => w.WarehouseId) - .FirstOrDefaultAsync(ct); - var secondaryWarehouse = await db.Warehouses.AsNoTracking() - .OrderByDescending(w => w.WarehouseId) - .FirstOrDefaultAsync(ct); - var items = await db.Items.AsNoTracking() - .OrderBy(i => i.ItemId) - .Take(2) - .ToListAsync(ct); - var uom = await db.Uoms.AsNoTracking() - .OrderBy(u => u.UomId) - .FirstOrDefaultAsync(ct); - var user = await db.Users.AsNoTracking() - .OrderBy(u => u.UserId) - .FirstOrDefaultAsync(ct); - - if (customer is null || warehouse is null || secondaryWarehouse is null || items.Count < 2 || uom is null || user is null) - return false; - - var postableItem = items[0]; - var shortageItem = items[1]; - var today = DateTime.UtcNow.Date; - var createdAt = DateTime.UtcNow.AddDays(-1); - - db.SalesInvoices.AddRange( - new SalesInvoice - { - InvoiceNo = $"SI-{today:yyyy}-00001", - InvoiceDate = today.AddDays(-2), - CustomerId = customer.CustomerId, - CustomerSnapshotName = customer.Name, - CustomerSnapshotTaxNo = customer.TaxRegistrationNo, - WarehouseId = warehouse.WarehouseId, - InvoiceType = SalesInvoiceType.B2C, - Status = SalesInvoiceStatus.Draft, - Subtotal = 200m, - DiscountTotal = 0m, - TaxTotal = 0m, - GrandTotal = 200m, - RoundOff = 0m, - NetPayable = 200m, - PaidAmount = 0m, - BalanceAmount = 200m, - CreatedBy = user.UserId, - CreatedAt = createdAt, - Lines = - [ - new SalesInvoiceLine - { - ItemId = postableItem.ItemId, - Description = postableItem.Name, - Qty = 2m, - FreeQty = 0m, - WarehouseId = warehouse.WarehouseId, - UnitPrice = 100m, - BaseCost = 0m, - PriceSource = "seed", - DiscountMode = SalesDiscountMode.Percentage, - DiscountPct = 0m, - DiscountAmount = 0m, - NetUnitPrice = 100m, - LineTotal = 200m, - TaxPct = 0m, - TaxAmount = 0m, - IsFreeIssue = false - } - ] - }, - new SalesInvoice - { - InvoiceNo = $"SI-{today:yyyy}-00002", - InvoiceDate = today.AddDays(-1), - CustomerId = customer.CustomerId, - CustomerSnapshotName = customer.Name, - CustomerSnapshotTaxNo = customer.TaxRegistrationNo, - WarehouseId = secondaryWarehouse.WarehouseId, - InvoiceType = SalesInvoiceType.B2B, - Status = SalesInvoiceStatus.Draft, - Subtotal = 300m, - DiscountTotal = 0m, - TaxTotal = 0m, - GrandTotal = 300m, - RoundOff = 0m, - NetPayable = 300m, - PaidAmount = 0m, - BalanceAmount = 300m, - CreatedBy = user.UserId, - CreatedAt = createdAt, - Lines = - [ - new SalesInvoiceLine - { - ItemId = shortageItem.ItemId, - Description = shortageItem.Name, - Qty = 6m, - FreeQty = 0m, - WarehouseId = secondaryWarehouse.WarehouseId, - UnitPrice = 50m, - BaseCost = 0m, - PriceSource = "seed", - DiscountMode = SalesDiscountMode.Percentage, - DiscountPct = 0m, - DiscountAmount = 0m, - NetUnitPrice = 50m, - LineTotal = 300m, - TaxPct = 0m, - TaxAmount = 0m, - IsFreeIssue = false - } - ] - }, - new SalesInvoice - { - InvoiceNo = $"SI-{today:yyyy}-00003", - InvoiceDate = today, - CustomerId = customer.CustomerId, - CustomerSnapshotName = customer.Name, - CustomerSnapshotTaxNo = customer.TaxRegistrationNo, - WarehouseId = warehouse.WarehouseId, - InvoiceType = SalesInvoiceType.B2C, - Status = SalesInvoiceStatus.Posted, - Subtotal = 100m, - DiscountTotal = 0m, - TaxTotal = 0m, - GrandTotal = 100m, - RoundOff = 0m, - NetPayable = 100m, - PaidAmount = 100m, - BalanceAmount = 0m, - CreatedBy = user.UserId, - CreatedAt = createdAt, - UpdatedAt = DateTime.UtcNow, - Lines = - [ - new SalesInvoiceLine - { - ItemId = postableItem.ItemId, - Description = postableItem.Name, - Qty = 1m, - FreeQty = 0m, - WarehouseId = warehouse.WarehouseId, - UnitPrice = 100m, - BaseCost = 0m, - PriceSource = "seed", - DiscountMode = SalesDiscountMode.Percentage, - DiscountPct = 0m, - DiscountAmount = 0m, - NetUnitPrice = 100m, - LineTotal = 100m, - TaxPct = 0m, - TaxAmount = 0m, - IsFreeIssue = false - } - ] - } - ); - - db.SalesSlips.AddRange( - new SalesSlip - { - SlipNo = $"SSL-{today:yyyy}-00001", - SlipDate = today.AddDays(-2), - CustomerId = customer.CustomerId, - CustomerSnapshotName = customer.Name, - WarehouseId = warehouse.WarehouseId, - CashierUserId = user.UserId, - Status = SalesSlipStatus.Draft, - Subtotal = 50m, - DiscountTotal = 0m, - TaxTotal = 0m, - GrandTotal = 50m, - PaidAmount = 0m, - BalanceAmount = 50m, - CreatedAt = createdAt, - Lines = - [ - new SalesSlipLine - { - ItemId = postableItem.ItemId, - Description = postableItem.Name, - Qty = 1m, - FreeQty = 0m, - WarehouseId = warehouse.WarehouseId, - UnitPrice = 50m, - BaseCost = 0m, - PriceSource = "seed", - DiscountMode = SalesDiscountMode.Percentage, - DiscountPct = 0m, - DiscountAmount = 0m, - NetUnitPrice = 50m, - LineTotal = 50m, - TaxPct = 0m, - TaxAmount = 0m, - IsFreeIssue = false - } - ] - }, - new SalesSlip - { - SlipNo = $"SSL-{today:yyyy}-00002", - SlipDate = today.AddDays(-1), - CustomerId = customer.CustomerId, - CustomerSnapshotName = customer.Name, - WarehouseId = secondaryWarehouse.WarehouseId, - CashierUserId = user.UserId, - Status = SalesSlipStatus.Draft, - Subtotal = 150m, - DiscountTotal = 15m, - TaxTotal = 0m, - GrandTotal = 135m, - PaidAmount = 0m, - BalanceAmount = 135m, - CreatedAt = createdAt, - Lines = - [ - new SalesSlipLine - { - ItemId = shortageItem.ItemId, - Description = shortageItem.Name, - Qty = 3m, - FreeQty = 0m, - WarehouseId = secondaryWarehouse.WarehouseId, - UnitPrice = 50m, - BaseCost = 0m, - PriceSource = "seed", - DiscountMode = SalesDiscountMode.Percentage, - DiscountPct = 10m, - DiscountAmount = 15m, - NetUnitPrice = 45m, - LineTotal = 135m, - TaxPct = 0m, - TaxAmount = 0m, - IsFreeIssue = false - } - ] - } - ); - - return true; - } } diff --git a/Backend/ERPCore/Infra/Persistence/ErpDbContext.cs b/Backend/ERPCore/Infra/Persistence/ErpDbContext.cs index 67b7c44..45d6d7f 100644 --- a/Backend/ERPCore/Infra/Persistence/ErpDbContext.cs +++ b/Backend/ERPCore/Infra/Persistence/ErpDbContext.cs @@ -2,6 +2,7 @@ using ERPCore.Domain.Entities; using ERPCore.Infra.Auth; using ERPCore.Infra.Persistence.Auditing; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; namespace ERPCore.Infra.Persistence; @@ -189,6 +190,15 @@ public class ErpDbContext : DbContext // (Infra/Persistence/Configurations/*). modelBuilder.ApplyConfigurationsFromAssembly(typeof(ErpDbContext).Assembly); + // Pin the collation on the model. Pomelo emits `CharSet utf8mb4` per table/column but + // no collation, so without this every column silently takes the charset's server + // default — utf8mb4_general_ci on MariaDB — regardless of what the database is set to. + // utf8mb4_unicode_ci is case-insensitive (which is the decided semantics: it keeps the + // 48 EF.Functions.Like searches behaving like the old ILIKE, and makes the uniqueness + // guards consistent with their backing indexes) but uses proper UCA ordering rather + // than general_ci's simplified table. MariaDB has no utf8mb4_0900_ai_ci. + modelBuilder.UseCollation("utf8mb4_unicode_ci"); + // Global read-side branch scoping (docs/BRANCH_ISOLATION_PLAN.md). Only for entities // that carry an explicit BranchId directly — warehouse-inherited entities (Grn, // StockLayer, StockTransfer, ...) are NOT covered here (would need an extra join in @@ -202,10 +212,35 @@ public class ErpDbContext : DbContext modelBuilder.Entity().HasQueryFilter(e => !_currentBranch.IsActive || e.BranchId == _currentBranch.BranchId); modelBuilder.Entity().HasQueryFilter(e => !_currentBranch.IsActive || e.BranchId == _currentBranch.BranchId); - // Npgsql requires DateTime values written to `timestamp with time zone` columns - // to have Kind=Utc; dates deserialized from a JSON request body (hire date, - // salary-structure effective date, etc.) come in as Kind=Unspecified and would - // otherwise throw at SaveChanges time. Force Utc kind globally for every + // Optimistic concurrency token. On PostgreSQL this was the virtual `xmin` system + // column via .IsRowVersion(), which the engine maintained for free. MariaDB has no + // equivalent: Pomelo maps .IsRowVersion() on a uint to a plain `int unsigned` column + // marked ValueGeneratedOnAddOrUpdate, so EF expects the *database* to bump it and the + // database never does — every row would sit at 0 and the concurrency check would + // silently always pass. So the column is real, generated by nothing, and incremented + // by BumpRowVersions() in the SaveChanges overrides below. + // + // Applied as a convention rather than 49 hand edits: a loop cannot miss an entity, + // and a missed one is invisible (a non-token column, no error, no protection). + foreach (var entityType in modelBuilder.Model.GetEntityTypes()) + { + var rowVersion = entityType.FindProperty(RowVersionProperty); + if (rowVersion is null || rowVersion.ClrType != typeof(uint)) continue; + + rowVersion.IsConcurrencyToken = true; + // ValueGenerated.Never is load-bearing: anything else and EF refuses to write the + // value we compute. Deliberately no HasDefaultValue(0) either — a store default + // makes EF omit the column from INSERTs and treat it as store-generated. + rowVersion.ValueGenerated = ValueGenerated.Never; + rowVersion.IsNullable = false; + } + + // MariaDB does not have `timestamp with time zone`; values are stored as datetime(6) + // in UTC. This converter is still load-bearing (do NOT delete it as a Postgres-only + // artifact): dates deserialized from a JSON request body (hire date, salary-structure + // effective date, etc.) arrive as Kind=Unspecified, and MySqlConnector hands values + // back as Kind=Unspecified too, so both directions need pinning. Force Utc kind + // globally for every // DateTime/DateTime? property rather than remembering to convert at each HRM // service call site (docs/12-BACKEND-HRM.md — new in Phase 2; Phase 1 never hit // this because it only ever persisted server-generated DateTime.UtcNow values). @@ -226,14 +261,60 @@ public class ErpDbContext : DbContext } } + /// + /// Name of the optimistic-concurrency token property. Must stay "RowVersion": + /// the CLR type uint is what lets and every + /// If-Match call site stay unchanged. + /// + internal const string RowVersionProperty = "RowVersion"; + + /// + /// Increments the concurrency token for every inserted or modified entity that carries + /// one. Replaces what PostgreSQL's xmin did automatically. + /// + private void BumpRowVersions() + { + foreach (var entry in ChangeTracker.Entries()) + { + if (entry.State is not (EntityState.Added or EntityState.Modified)) continue; + + var meta = entry.Metadata.FindProperty(RowVersionProperty); + if (meta is null || meta.ClrType != typeof(uint)) continue; + + var p = entry.Property(RowVersionProperty); + + // New rows start at 1, never 0: ETag.TryParse("AAAAAA==") succeeds and yields 0, + // so a client sending the all-zero token (exactly what a default-initialised uint + // produces) would otherwise pass the pre-check on every never-updated row. + // Starting at 1 keeps 0 permanently non-live. + // + // Updates increment OriginalValue, NOT CurrentValue. EF emits + // SET RowVersion = @new WHERE pk = @pk AND RowVersion = @orig + // taking WHERE from OriginalValue and SET from CurrentValue. Basing the new value + // on CurrentValue would break the moment anything else touches the property (a DTO + // mapper, a detached graph attach), producing a value unrelated to the row and an + // intermittent spurious 412 on the happy path. + p.CurrentValue = entry.State == EntityState.Added + ? 1u + : (uint)(p.OriginalValue ?? 0u) + 1u; + } + } + // Audit trail (FR-X-02): capture mutations before save (accurate old→new), then // write the log rows once inserts have their generated keys. A second base save // persists the logs without re-auditing them. + // + // BumpRowVersions runs AFTER AuditScribe.Capture (which has already serialised each + // change set into an immutable string, so the token bump physically cannot leak into an + // audit payload) and BEFORE the first base save. It is called here rather than from a + // SaveChangesInterceptor precisely because base.Save… is invoked twice below — an + // interceptor would fire on both and double-bump. public override async Task SaveChangesAsync(bool acceptAllChangesOnSuccess, CancellationToken ct = default) { IReadOnlyList pending = _writingAuditLogs ? Array.Empty() : AuditScribe.Capture(ChangeTracker); + BumpRowVersions(); var result = await base.SaveChangesAsync(acceptAllChangesOnSuccess, ct); if (pending.Count > 0) { @@ -256,6 +337,7 @@ public class ErpDbContext : DbContext IReadOnlyList pending = _writingAuditLogs ? Array.Empty() : AuditScribe.Capture(ChangeTracker); + BumpRowVersions(); var result = base.SaveChanges(acceptAllChangesOnSuccess); if (pending.Count > 0) { diff --git a/Backend/ERPCore/Infra/UoW/UnitOfWork.cs b/Backend/ERPCore/Infra/UoW/UnitOfWork.cs index f6148e1..600a110 100644 --- a/Backend/ERPCore/Infra/UoW/UnitOfWork.cs +++ b/Backend/ERPCore/Infra/UoW/UnitOfWork.cs @@ -1,12 +1,22 @@ +using System.Data; using ERPCore.Infra.Persistence; using Microsoft.EntityFrameworkCore; namespace ERPCore.Infra.UoW; /// -/// EF Core-backed unit of work. Uses the provider execution strategy so the -/// transactional path is safe under connection resiliency / retries. +/// EF Core-backed unit of work. Opens every transaction at READ COMMITTED to match the +/// semantics the code was written against (MariaDB defaults to REPEATABLE READ, where a +/// plain read inside a transaction returns a pinned snapshot while a locking read does not). /// +/// +/// Do NOT enable EnableRetryOnFailure to "harden" this. The execution strategy is +/// currently non-retrying, so the lambda runs exactly once. With retries on, EF re-runs the +/// lambda without resetting the ChangeTracker, and callers such as +/// ProductionRunService.ApproveStageAsync capture mutable state outside it — a retry +/// would re-insert already-Added entities and duplicate ledger/layer rows, which is precisely +/// the corruption the concurrency token exists to prevent. +/// public sealed class UnitOfWork : IUnitOfWork { private readonly ErpDbContext _db; @@ -29,7 +39,7 @@ public sealed class UnitOfWork : IUnitOfWork var strategy = _db.Database.CreateExecutionStrategy(); return await strategy.ExecuteAsync(async () => { - await using var tx = await _db.Database.BeginTransactionAsync(ct); + await using var tx = await _db.Database.BeginTransactionAsync(IsolationLevel.ReadCommitted, ct); try { var result = await action(ct); diff --git a/Backend/ERPCore/Migrations/20260811053751_initial.Designer.cs b/Backend/ERPCore/Migrations/20260811053751_initial.Designer.cs deleted file mode 100644 index 2075b1e..0000000 --- a/Backend/ERPCore/Migrations/20260811053751_initial.Designer.cs +++ /dev/null @@ -1,6951 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260811053751_initial")] - partial class initial - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 3, - Code = "vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - SortOrder = 3, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:vendors", - NavItemId = 3 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260811095944_AddItemTypeIsMeasurable.Designer.cs b/Backend/ERPCore/Migrations/20260811095944_AddItemTypeIsMeasurable.Designer.cs deleted file mode 100644 index 9a3dbc5..0000000 --- a/Backend/ERPCore/Migrations/20260811095944_AddItemTypeIsMeasurable.Designer.cs +++ /dev/null @@ -1,6956 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260811095944_AddItemTypeIsMeasurable")] - partial class AddItemTypeIsMeasurable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 3, - Code = "vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - SortOrder = 3, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:vendors", - NavItemId = 3 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260811095944_AddItemTypeIsMeasurable.cs b/Backend/ERPCore/Migrations/20260811095944_AddItemTypeIsMeasurable.cs deleted file mode 100644 index f3d277d..0000000 --- a/Backend/ERPCore/Migrations/20260811095944_AddItemTypeIsMeasurable.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddItemTypeIsMeasurable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "IsMeasurable", - table: "item_types", - type: "boolean", - nullable: false, - defaultValue: false); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "IsMeasurable", - table: "item_types"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260812091117_AddGrnGlPostingAndPayments.Designer.cs b/Backend/ERPCore/Migrations/20260812091117_AddGrnGlPostingAndPayments.Designer.cs deleted file mode 100644 index 07170f5..0000000 --- a/Backend/ERPCore/Migrations/20260812091117_AddGrnGlPostingAndPayments.Designer.cs +++ /dev/null @@ -1,7188 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260812091117_AddGrnGlPostingAndPayments")] - partial class AddGrnGlPostingAndPayments - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b => - { - b.Property("GrnPaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnPaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("GrnPaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("GrnId"); - - b.ToTable("grn_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 3, - Code = "vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - SortOrder = 3, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:vendors", - NavItemId = 3 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Payments") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Grn"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260812091117_AddGrnGlPostingAndPayments.cs b/Backend/ERPCore/Migrations/20260812091117_AddGrnGlPostingAndPayments.cs deleted file mode 100644 index 7c2cdd0..0000000 --- a/Backend/ERPCore/Migrations/20260812091117_AddGrnGlPostingAndPayments.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddGrnGlPostingAndPayments : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "BalanceAmount", - table: "grns", - type: "numeric(18,4)", - precision: 18, - scale: 4, - nullable: false, - defaultValue: 0m); - - migrationBuilder.AddColumn( - name: "GlJournalNo", - table: "grns", - type: "character varying(30)", - maxLength: 30, - nullable: true); - - migrationBuilder.AddColumn( - name: "GlPostedAt", - table: "grns", - type: "timestamp with time zone", - nullable: true); - - migrationBuilder.AddColumn( - name: "PaidAmount", - table: "grns", - type: "numeric(18,4)", - precision: 18, - scale: 4, - nullable: false, - defaultValue: 0m); - - migrationBuilder.CreateTable( - name: "grn_payments", - columns: table => new - { - GrnPaymentId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - GrnId = table.Column(type: "integer", nullable: false), - Amount = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - PaymentDate = table.Column(type: "timestamp with time zone", nullable: false), - GlBankAccountId = table.Column(type: "bigint", nullable: false), - BankAccountName = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Reference = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), - GlJournalNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: true), - CreatedBy = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_grn_payments", x => x.GrnPaymentId); - table.ForeignKey( - name: "FK_grn_payments_grns_GrnId", - column: x => x.GrnId, - principalTable: "grns", - principalColumn: "GrnId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_grn_payments_users_CreatedBy", - column: x => x.CreatedBy, - principalTable: "users", - principalColumn: "UserId", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_grn_payments_CreatedBy", - table: "grn_payments", - column: "CreatedBy"); - - migrationBuilder.CreateIndex( - name: "IX_grn_payments_GrnId", - table: "grn_payments", - column: "GrnId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "grn_payments"); - - migrationBuilder.DropColumn( - name: "BalanceAmount", - table: "grns"); - - migrationBuilder.DropColumn( - name: "GlJournalNo", - table: "grns"); - - migrationBuilder.DropColumn( - name: "GlPostedAt", - table: "grns"); - - migrationBuilder.DropColumn( - name: "PaidAmount", - table: "grns"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260813091828_warrenty.Designer.cs b/Backend/ERPCore/Migrations/20260813091828_warrenty.Designer.cs deleted file mode 100644 index b9367d0..0000000 --- a/Backend/ERPCore/Migrations/20260813091828_warrenty.Designer.cs +++ /dev/null @@ -1,7156 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260813091828_warrenty")] - partial class warrenty - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 3, - Code = "vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - SortOrder = 3, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:vendors", - NavItemId = 3 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260813091828_warrenty.cs b/Backend/ERPCore/Migrations/20260813091828_warrenty.cs deleted file mode 100644 index 123dabd..0000000 --- a/Backend/ERPCore/Migrations/20260813091828_warrenty.cs +++ /dev/null @@ -1,196 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class warrenty : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Warranty", - table: "items", - type: "character varying(20)", - maxLength: 20, - nullable: false, - defaultValue: "NonWarranty"); - - migrationBuilder.AddColumn( - name: "WarrantyPeriodMonths", - table: "items", - type: "integer", - nullable: true); - - migrationBuilder.CreateTable( - name: "grn_line_warranty_numbers", - columns: table => new - { - GrnLineWarrantyNumberId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - GrnLineId = table.Column(type: "integer", nullable: false), - WarrantyNo = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), - WarrantyPeriodMonths = table.Column(type: "integer", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_grn_line_warranty_numbers", x => x.GrnLineWarrantyNumberId); - table.ForeignKey( - name: "FK_grn_line_warranty_numbers_grn_lines_GrnLineId", - column: x => x.GrnLineId, - principalTable: "grn_lines", - principalColumn: "GrnLineId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "sales_returns", - columns: table => new - { - ReturnId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - DocNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: false), - CustomerId = table.Column(type: "integer", nullable: false), - WarehouseId = table.Column(type: "integer", nullable: false), - ReasonCodeId = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - CreatedBy = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_sales_returns", x => x.ReturnId); - table.ForeignKey( - name: "FK_sales_returns_customers_CustomerId", - column: x => x.CustomerId, - principalTable: "customers", - principalColumn: "CustomerId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_sales_returns_reason_codes_ReasonCodeId", - column: x => x.ReasonCodeId, - principalTable: "reason_codes", - principalColumn: "ReasonCodeId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_sales_returns_users_CreatedBy", - column: x => x.CreatedBy, - principalTable: "users", - principalColumn: "UserId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_sales_returns_warehouses_WarehouseId", - column: x => x.WarehouseId, - principalTable: "warehouses", - principalColumn: "WarehouseId", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "sales_return_lines", - columns: table => new - { - ReturnLineId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ReturnId = table.Column(type: "integer", nullable: false), - SalesInvoiceLineId = table.Column(type: "integer", nullable: true), - ItemId = table.Column(type: "integer", nullable: false), - Qty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_sales_return_lines", x => x.ReturnLineId); - table.ForeignKey( - name: "FK_sales_return_lines_items_ItemId", - column: x => x.ItemId, - principalTable: "items", - principalColumn: "ItemId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_sales_return_lines_sales_invoice_lines_SalesInvoiceLineId", - column: x => x.SalesInvoiceLineId, - principalTable: "sales_invoice_lines", - principalColumn: "SalesInvoiceLineId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_sales_return_lines_sales_returns_ReturnId", - column: x => x.ReturnId, - principalTable: "sales_returns", - principalColumn: "ReturnId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_grn_line_warranty_numbers_GrnLineId_WarrantyNo", - table: "grn_line_warranty_numbers", - columns: new[] { "GrnLineId", "WarrantyNo" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_sales_return_lines_ItemId", - table: "sales_return_lines", - column: "ItemId"); - - migrationBuilder.CreateIndex( - name: "IX_sales_return_lines_ReturnId", - table: "sales_return_lines", - column: "ReturnId"); - - migrationBuilder.CreateIndex( - name: "IX_sales_return_lines_SalesInvoiceLineId", - table: "sales_return_lines", - column: "SalesInvoiceLineId"); - - migrationBuilder.CreateIndex( - name: "IX_sales_returns_CreatedBy", - table: "sales_returns", - column: "CreatedBy"); - - migrationBuilder.CreateIndex( - name: "IX_sales_returns_CustomerId", - table: "sales_returns", - column: "CustomerId"); - - migrationBuilder.CreateIndex( - name: "IX_sales_returns_DocNo", - table: "sales_returns", - column: "DocNo", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_sales_returns_ReasonCodeId", - table: "sales_returns", - column: "ReasonCodeId"); - - migrationBuilder.CreateIndex( - name: "IX_sales_returns_WarehouseId", - table: "sales_returns", - column: "WarehouseId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "grn_line_warranty_numbers"); - - migrationBuilder.DropTable( - name: "sales_return_lines"); - - migrationBuilder.DropTable( - name: "sales_returns"); - - migrationBuilder.DropColumn( - name: "Warranty", - table: "items"); - - migrationBuilder.DropColumn( - name: "WarrantyPeriodMonths", - table: "items"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260816130723_AddSalesDayEnd.Designer.cs b/Backend/ERPCore/Migrations/20260816130723_AddSalesDayEnd.Designer.cs deleted file mode 100644 index c5e9068..0000000 --- a/Backend/ERPCore/Migrations/20260816130723_AddSalesDayEnd.Designer.cs +++ /dev/null @@ -1,7351 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260816130723_AddSalesDayEnd")] - partial class AddSalesDayEnd - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b => - { - b.Property("GrnPaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnPaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("GrnPaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("GrnId"); - - b.ToTable("grn_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 3, - Code = "vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - SortOrder = 3, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:vendors", - NavItemId = 3 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Payments") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Grn"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260816130723_AddSalesDayEnd.cs b/Backend/ERPCore/Migrations/20260816130723_AddSalesDayEnd.cs deleted file mode 100644 index 42f7caa..0000000 --- a/Backend/ERPCore/Migrations/20260816130723_AddSalesDayEnd.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddSalesDayEnd : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "DayEndId", - table: "sales_slips", - type: "integer", - nullable: true); - - migrationBuilder.CreateTable( - name: "sales_day_ends", - columns: table => new - { - SalesDayEndId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - DocNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: false), - CashierUserId = table.Column(type: "integer", nullable: false), - BusinessDate = table.Column(type: "date", nullable: false), - SlipCount = table.Column(type: "integer", nullable: false), - Subtotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - DiscountTotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - TaxTotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - GrandTotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - CostOfGoodsSold = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - GlJournalNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: true), - GlPostedAt = table.Column(type: "timestamp with time zone", nullable: true), - ClosedBy = table.Column(type: "integer", nullable: false), - ClosedAt = table.Column(type: "timestamp with time zone", nullable: false), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_sales_day_ends", x => x.SalesDayEndId); - table.ForeignKey( - name: "FK_sales_day_ends_users_CashierUserId", - column: x => x.CashierUserId, - principalTable: "users", - principalColumn: "UserId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_sales_day_ends_users_ClosedBy", - column: x => x.ClosedBy, - principalTable: "users", - principalColumn: "UserId", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_sales_slips_DayEndId", - table: "sales_slips", - column: "DayEndId"); - - migrationBuilder.CreateIndex( - name: "IX_sales_day_ends_CashierUserId_BusinessDate", - table: "sales_day_ends", - columns: new[] { "CashierUserId", "BusinessDate" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_sales_day_ends_ClosedBy", - table: "sales_day_ends", - column: "ClosedBy"); - - migrationBuilder.CreateIndex( - name: "IX_sales_day_ends_DocNo", - table: "sales_day_ends", - column: "DocNo", - unique: true); - - migrationBuilder.AddForeignKey( - name: "FK_sales_slips_sales_day_ends_DayEndId", - table: "sales_slips", - column: "DayEndId", - principalTable: "sales_day_ends", - principalColumn: "SalesDayEndId", - onDelete: ReferentialAction.Restrict); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_sales_slips_sales_day_ends_DayEndId", - table: "sales_slips"); - - migrationBuilder.DropTable( - name: "sales_day_ends"); - - migrationBuilder.DropIndex( - name: "IX_sales_slips_DayEndId", - table: "sales_slips"); - - migrationBuilder.DropColumn( - name: "DayEndId", - table: "sales_slips"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260816133305_AddReturnGlPosting.Designer.cs b/Backend/ERPCore/Migrations/20260816133305_AddReturnGlPosting.Designer.cs deleted file mode 100644 index 9194130..0000000 --- a/Backend/ERPCore/Migrations/20260816133305_AddReturnGlPosting.Designer.cs +++ /dev/null @@ -1,7365 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260816133305_AddReturnGlPosting")] - partial class AddReturnGlPosting - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b => - { - b.Property("GrnPaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnPaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("GrnPaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("GrnId"); - - b.ToTable("grn_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 3, - Code = "vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - SortOrder = 3, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:vendors", - NavItemId = 3 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Payments") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Grn"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260816133305_AddReturnGlPosting.cs b/Backend/ERPCore/Migrations/20260816133305_AddReturnGlPosting.cs deleted file mode 100644 index 6b15158..0000000 --- a/Backend/ERPCore/Migrations/20260816133305_AddReturnGlPosting.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddReturnGlPosting : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "GlJournalNo", - table: "sales_returns", - type: "character varying(30)", - maxLength: 30, - nullable: true); - - migrationBuilder.AddColumn( - name: "GlPostedAt", - table: "sales_returns", - type: "timestamp with time zone", - nullable: true); - - migrationBuilder.AddColumn( - name: "GlJournalNo", - table: "purchase_returns", - type: "character varying(30)", - maxLength: 30, - nullable: true); - - migrationBuilder.AddColumn( - name: "GlPostedAt", - table: "purchase_returns", - type: "timestamp with time zone", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "GlJournalNo", - table: "sales_returns"); - - migrationBuilder.DropColumn( - name: "GlPostedAt", - table: "sales_returns"); - - migrationBuilder.DropColumn( - name: "GlJournalNo", - table: "purchase_returns"); - - migrationBuilder.DropColumn( - name: "GlPostedAt", - table: "purchase_returns"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260816142234_AddAdjustmentGlPosting.Designer.cs b/Backend/ERPCore/Migrations/20260816142234_AddAdjustmentGlPosting.Designer.cs deleted file mode 100644 index bbae9b0..0000000 --- a/Backend/ERPCore/Migrations/20260816142234_AddAdjustmentGlPosting.Designer.cs +++ /dev/null @@ -1,7372 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260816142234_AddAdjustmentGlPosting")] - partial class AddAdjustmentGlPosting - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b => - { - b.Property("GrnPaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnPaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("GrnPaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("GrnId"); - - b.ToTable("grn_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 3, - Code = "vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - SortOrder = 3, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:vendors", - NavItemId = 3 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Payments") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Grn"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260816142234_AddAdjustmentGlPosting.cs b/Backend/ERPCore/Migrations/20260816142234_AddAdjustmentGlPosting.cs deleted file mode 100644 index f862de9..0000000 --- a/Backend/ERPCore/Migrations/20260816142234_AddAdjustmentGlPosting.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddAdjustmentGlPosting : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "GlJournalNo", - table: "stock_adjustments", - type: "character varying(30)", - maxLength: 30, - nullable: true); - - migrationBuilder.AddColumn( - name: "GlPostedAt", - table: "stock_adjustments", - type: "timestamp with time zone", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "GlJournalNo", - table: "stock_adjustments"); - - migrationBuilder.DropColumn( - name: "GlPostedAt", - table: "stock_adjustments"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260816151344_AddBundleSaleToDayEnd.Designer.cs b/Backend/ERPCore/Migrations/20260816151344_AddBundleSaleToDayEnd.Designer.cs deleted file mode 100644 index d470590..0000000 --- a/Backend/ERPCore/Migrations/20260816151344_AddBundleSaleToDayEnd.Designer.cs +++ /dev/null @@ -1,7391 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260816151344_AddBundleSaleToDayEnd")] - partial class AddBundleSaleToDayEnd - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b => - { - b.Property("GrnPaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnPaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("GrnPaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("GrnId"); - - b.ToTable("grn_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 3, - Code = "vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - SortOrder = 3, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:vendors", - NavItemId = 3 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Payments") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Grn"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260816151344_AddBundleSaleToDayEnd.cs b/Backend/ERPCore/Migrations/20260816151344_AddBundleSaleToDayEnd.cs deleted file mode 100644 index 0b59002..0000000 --- a/Backend/ERPCore/Migrations/20260816151344_AddBundleSaleToDayEnd.cs +++ /dev/null @@ -1,60 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddBundleSaleToDayEnd : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "BundleCount", - table: "sales_day_ends", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "DayEndId", - table: "bundle_sales", - type: "integer", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_bundle_sales_DayEndId", - table: "bundle_sales", - column: "DayEndId"); - - migrationBuilder.AddForeignKey( - name: "FK_bundle_sales_sales_day_ends_DayEndId", - table: "bundle_sales", - column: "DayEndId", - principalTable: "sales_day_ends", - principalColumn: "SalesDayEndId", - onDelete: ReferentialAction.Restrict); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_bundle_sales_sales_day_ends_DayEndId", - table: "bundle_sales"); - - migrationBuilder.DropIndex( - name: "IX_bundle_sales_DayEndId", - table: "bundle_sales"); - - migrationBuilder.DropColumn( - name: "BundleCount", - table: "sales_day_ends"); - - migrationBuilder.DropColumn( - name: "DayEndId", - table: "bundle_sales"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260816174034_AddSalesInvoicePayments.Designer.cs b/Backend/ERPCore/Migrations/20260816174034_AddSalesInvoicePayments.Designer.cs deleted file mode 100644 index a8b7ba2..0000000 --- a/Backend/ERPCore/Migrations/20260816174034_AddSalesInvoicePayments.Designer.cs +++ /dev/null @@ -1,7468 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260816174034_AddSalesInvoicePayments")] - partial class AddSalesInvoicePayments - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b => - { - b.Property("GrnPaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnPaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("GrnPaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("GrnId"); - - b.ToTable("grn_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 3, - Code = "vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - SortOrder = 3, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:vendors", - NavItemId = 3 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Payments") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Grn"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260816174034_AddSalesInvoicePayments.cs b/Backend/ERPCore/Migrations/20260816174034_AddSalesInvoicePayments.cs deleted file mode 100644 index fbaab34..0000000 --- a/Backend/ERPCore/Migrations/20260816174034_AddSalesInvoicePayments.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddSalesInvoicePayments : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "GlJournalNo", - table: "sales_invoices", - type: "character varying(30)", - maxLength: 30, - nullable: true); - - migrationBuilder.AddColumn( - name: "GlPostedAt", - table: "sales_invoices", - type: "timestamp with time zone", - nullable: true); - - migrationBuilder.CreateTable( - name: "sales_invoice_payments", - columns: table => new - { - SalesInvoicePaymentId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - SalesInvoiceId = table.Column(type: "integer", nullable: false), - Amount = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - PaymentDate = table.Column(type: "timestamp with time zone", nullable: false), - GlBankAccountId = table.Column(type: "bigint", nullable: false), - BankAccountName = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Reference = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), - GlJournalNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: true), - CreatedBy = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_sales_invoice_payments", x => x.SalesInvoicePaymentId); - table.ForeignKey( - name: "FK_sales_invoice_payments_sales_invoices_SalesInvoiceId", - column: x => x.SalesInvoiceId, - principalTable: "sales_invoices", - principalColumn: "SalesInvoiceId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_sales_invoice_payments_users_CreatedBy", - column: x => x.CreatedBy, - principalTable: "users", - principalColumn: "UserId", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_sales_invoice_payments_CreatedBy", - table: "sales_invoice_payments", - column: "CreatedBy"); - - migrationBuilder.CreateIndex( - name: "IX_sales_invoice_payments_SalesInvoiceId", - table: "sales_invoice_payments", - column: "SalesInvoiceId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "sales_invoice_payments"); - - migrationBuilder.DropColumn( - name: "GlJournalNo", - table: "sales_invoices"); - - migrationBuilder.DropColumn( - name: "GlPostedAt", - table: "sales_invoices"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260818090139_AddProductionNavPermissions.Designer.cs b/Backend/ERPCore/Migrations/20260818090139_AddProductionNavPermissions.Designer.cs deleted file mode 100644 index ef295c4..0000000 --- a/Backend/ERPCore/Migrations/20260818090139_AddProductionNavPermissions.Designer.cs +++ /dev/null @@ -1,7531 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260818090139_AddProductionNavPermissions")] - partial class AddProductionNavPermissions - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b => - { - b.Property("GrnPaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnPaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("GrnPaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("GrnId"); - - b.ToTable("grn_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 3, - Code = "vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - SortOrder = 3, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:vendors", - NavItemId = 3 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 24 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Payments") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Grn"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260818090139_AddProductionNavPermissions.cs b/Backend/ERPCore/Migrations/20260818090139_AddProductionNavPermissions.cs deleted file mode 100644 index 6fa2164..0000000 --- a/Backend/ERPCore/Migrations/20260818090139_AddProductionNavPermissions.cs +++ /dev/null @@ -1,90 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional - -namespace ERPCore.Migrations -{ - /// - public partial class AddProductionNavPermissions : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.InsertData( - table: "nav_items", - columns: new[] { "NavItemId", "Code", "Href", "Icon", "Label", "SortOrder" }, - values: new object[] { 14, "production", "/dashboard/production", null, "Production", 14 }); - - migrationBuilder.InsertData( - table: "permissions", - columns: new[] { "PermissionId", "Code", "NavItemId", "SubNavItemId" }, - values: new object[] { 35, "NAV:production", 14, null }); - - migrationBuilder.InsertData( - table: "sub_nav_items", - columns: new[] { "SubNavItemId", "Code", "Href", "Icon", "Label", "NavItemId", "SortOrder" }, - values: new object[,] - { - { 24, "production.templates", "/dashboard/production/templates", null, "Templates", 14, 1 }, - { 25, "production.runs", "/dashboard/production/runs", null, "Runs", 14, 2 }, - { 26, "production.produced", "/dashboard/production/produced", null, "Produced", 14, 3 } - }); - - migrationBuilder.InsertData( - table: "permissions", - columns: new[] { "PermissionId", "Code", "NavItemId", "SubNavItemId" }, - values: new object[,] - { - { 36, "NAV:production.templates", null, 24 }, - { 37, "NAV:production.runs", null, 25 }, - { 38, "NAV:production.produced", null, 26 } - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DeleteData( - table: "permissions", - keyColumn: "PermissionId", - keyValue: 35); - - migrationBuilder.DeleteData( - table: "permissions", - keyColumn: "PermissionId", - keyValue: 36); - - migrationBuilder.DeleteData( - table: "permissions", - keyColumn: "PermissionId", - keyValue: 37); - - migrationBuilder.DeleteData( - table: "permissions", - keyColumn: "PermissionId", - keyValue: 38); - - migrationBuilder.DeleteData( - table: "sub_nav_items", - keyColumn: "SubNavItemId", - keyValue: 24); - - migrationBuilder.DeleteData( - table: "sub_nav_items", - keyColumn: "SubNavItemId", - keyValue: 25); - - migrationBuilder.DeleteData( - table: "sub_nav_items", - keyColumn: "SubNavItemId", - keyValue: 26); - - migrationBuilder.DeleteData( - table: "nav_items", - keyColumn: "NavItemId", - keyValue: 14); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260820083810_itemModel.Designer.cs b/Backend/ERPCore/Migrations/20260820083810_itemModel.Designer.cs deleted file mode 100644 index b9a9604..0000000 --- a/Backend/ERPCore/Migrations/20260820083810_itemModel.Designer.cs +++ /dev/null @@ -1,7476 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260820083810_itemModel")] - partial class itemModel - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b => - { - b.Property("GrnPaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnPaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("GrnPaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("GrnId"); - - b.ToTable("grn_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 3, - Code = "vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - SortOrder = 3, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:vendors", - NavItemId = 3 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Payments") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Grn"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260820083810_itemModel.cs b/Backend/ERPCore/Migrations/20260820083810_itemModel.cs deleted file mode 100644 index bf7be6f..0000000 --- a/Backend/ERPCore/Migrations/20260820083810_itemModel.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class itemModel : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "SalePrice", - table: "items", - newName: "SellingMinPrice"); - - migrationBuilder.AddColumn( - name: "SellingFlatPrice", - table: "items", - type: "numeric(18,4)", - precision: 18, - scale: 4, - nullable: true); - - migrationBuilder.AddColumn( - name: "SellingMaxPrice", - table: "items", - type: "numeric(18,4)", - precision: 18, - scale: 4, - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "SellingFlatPrice", - table: "items"); - - migrationBuilder.DropColumn( - name: "SellingMaxPrice", - table: "items"); - - migrationBuilder.RenameColumn( - name: "SellingMinPrice", - table: "items", - newName: "SalePrice"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260820100345_AddNotificationConfigModulePreferences.Designer.cs b/Backend/ERPCore/Migrations/20260820100345_AddNotificationConfigModulePreferences.Designer.cs deleted file mode 100644 index 19e78c5..0000000 --- a/Backend/ERPCore/Migrations/20260820100345_AddNotificationConfigModulePreferences.Designer.cs +++ /dev/null @@ -1,7580 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260820100345_AddNotificationConfigModulePreferences")] - partial class AddNotificationConfigModulePreferences - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b => - { - b.Property("GrnPaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnPaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("GrnPaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("GrnId"); - - b.ToTable("grn_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 3, - Code = "vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - SortOrder = 3, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:vendors", - NavItemId = 3 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Payments") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Grn"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260820100345_AddNotificationConfigModulePreferences.cs b/Backend/ERPCore/Migrations/20260820100345_AddNotificationConfigModulePreferences.cs deleted file mode 100644 index fa6ce5a..0000000 --- a/Backend/ERPCore/Migrations/20260820100345_AddNotificationConfigModulePreferences.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddNotificationConfigModulePreferences : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "notification_config", - columns: table => new - { - NotificationConfigId = table.Column(type: "integer", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - UpdatedBy = table.Column(type: "integer", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_notification_config", x => x.NotificationConfigId); - table.CheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - table.ForeignKey( - name: "FK_notification_config_users_UpdatedBy", - column: x => x.UpdatedBy, - principalTable: "users", - principalColumn: "UserId", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "notification_config_modules", - columns: table => new - { - NotificationConfigModuleId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - NotificationConfigId = table.Column(type: "integer", nullable: false), - ModuleKey = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), - EmailEnabled = table.Column(type: "boolean", nullable: false, defaultValue: false), - SmsEnabled = table.Column(type: "boolean", nullable: false, defaultValue: false), - InAppEnabled = table.Column(type: "boolean", nullable: false, defaultValue: false) - }, - constraints: table => - { - table.PrimaryKey("PK_notification_config_modules", x => x.NotificationConfigModuleId); - table.ForeignKey( - name: "FK_notification_config_modules_notification_config_Notificatio~", - column: x => x.NotificationConfigId, - principalTable: "notification_config", - principalColumn: "NotificationConfigId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.Sql(""" - INSERT INTO sub_nav_items ("SubNavItemId", "NavItemId", "Code", "Href", "Icon", "Label", "SortOrder") - VALUES (24, 9, 'settings.notification-config', '/dashboard/settings/notification-config', NULL, 'Notification Config', 3) - ON CONFLICT ("SubNavItemId") DO UPDATE - SET "NavItemId" = EXCLUDED."NavItemId", - "Code" = EXCLUDED."Code", - "Href" = EXCLUDED."Href", - "Icon" = EXCLUDED."Icon", - "Label" = EXCLUDED."Label", - "SortOrder" = EXCLUDED."SortOrder"; - """); - - migrationBuilder.CreateIndex( - name: "IX_notification_config_UpdatedBy", - table: "notification_config", - column: "UpdatedBy"); - - migrationBuilder.CreateIndex( - name: "IX_notification_config_modules_ModuleKey", - table: "notification_config_modules", - column: "ModuleKey", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_notification_config_modules_NotificationConfigId", - table: "notification_config_modules", - column: "NotificationConfigId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "notification_config_modules"); - - migrationBuilder.DropTable( - name: "notification_config"); - - migrationBuilder.DeleteData( - table: "sub_nav_items", - keyColumn: "SubNavItemId", - keyValue: 24); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260820120000_UpdateItemSellingPrices.cs b/Backend/ERPCore/Migrations/20260820120000_UpdateItemSellingPrices.cs deleted file mode 100644 index 9652733..0000000 --- a/Backend/ERPCore/Migrations/20260820120000_UpdateItemSellingPrices.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - public partial class UpdateItemSellingPrices : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "SalePrice", - table: "items", - newName: "SellingFlatPrice"); - - migrationBuilder.AddColumn( - name: "SellingMinPrice", - table: "items", - type: "numeric(18,4)", - precision: 18, - scale: 4, - nullable: true); - - migrationBuilder.AddColumn( - name: "SellingMaxPrice", - table: "items", - type: "numeric(18,4)", - precision: 18, - scale: 4, - nullable: true); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "SellingMinPrice", - table: "items"); - - migrationBuilder.DropColumn( - name: "SellingMaxPrice", - table: "items"); - - migrationBuilder.RenameColumn( - name: "SellingFlatPrice", - table: "items", - newName: "SalePrice"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260820125724_AddProductConfigFeatureFlags.Designer.cs b/Backend/ERPCore/Migrations/20260820125724_AddProductConfigFeatureFlags.Designer.cs deleted file mode 100644 index 8d807c9..0000000 --- a/Backend/ERPCore/Migrations/20260820125724_AddProductConfigFeatureFlags.Designer.cs +++ /dev/null @@ -1,7600 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260820125724_AddProductConfigFeatureFlags")] - partial class AddProductConfigFeatureFlags - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b => - { - b.Property("GrnPaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnPaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("GrnPaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("GrnId"); - - b.ToTable("grn_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 3, - Code = "vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - SortOrder = 3, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:vendors", - NavItemId = 3 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnPayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Payments") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Grn"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260820125724_AddProductConfigFeatureFlags.cs b/Backend/ERPCore/Migrations/20260820125724_AddProductConfigFeatureFlags.cs deleted file mode 100644 index 291ece4..0000000 --- a/Backend/ERPCore/Migrations/20260820125724_AddProductConfigFeatureFlags.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddProductConfigFeatureFlags : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "BatchListsEnabled", - table: "product_config", - type: "boolean", - nullable: false, - defaultValue: true); - - migrationBuilder.AddColumn( - name: "SellingPricesEnabled", - table: "product_config", - type: "boolean", - nullable: false, - defaultValue: true); - - migrationBuilder.AddColumn( - name: "SerialNumbersEnabled", - table: "product_config", - type: "boolean", - nullable: false, - defaultValue: true); - - migrationBuilder.AddColumn( - name: "WarrantyPeriodsEnabled", - table: "product_config", - type: "boolean", - nullable: false, - defaultValue: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "BatchListsEnabled", - table: "product_config"); - - migrationBuilder.DropColumn( - name: "SellingPricesEnabled", - table: "product_config"); - - migrationBuilder.DropColumn( - name: "SerialNumbersEnabled", - table: "product_config"); - - migrationBuilder.DropColumn( - name: "WarrantyPeriodsEnabled", - table: "product_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260825000000_FixProductionTemplatesSubNavItemIdConflict.Designer.cs b/Backend/ERPCore/Migrations/20260825000000_FixProductionTemplatesSubNavItemIdConflict.Designer.cs deleted file mode 100644 index 51431e7..0000000 --- a/Backend/ERPCore/Migrations/20260825000000_FixProductionTemplatesSubNavItemIdConflict.Designer.cs +++ /dev/null @@ -1,24 +0,0 @@ -// -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260825000000_FixProductionTemplatesSubNavItemIdConflict")] - partial class FixProductionTemplatesSubNavItemIdConflict - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { - // This migration only repairs seed row data via raw SQL — no entity/column shape - // changes — so it does not redeclare the full model here. The single source of - // truth for scaffolding future migrations is ErpDbContextModelSnapshot.cs, which - // already reflects this fix (production.templates seeded at SubNavItemId 27). - } - } -} diff --git a/Backend/ERPCore/Migrations/20260825000000_FixProductionTemplatesSubNavItemIdConflict.cs b/Backend/ERPCore/Migrations/20260825000000_FixProductionTemplatesSubNavItemIdConflict.cs deleted file mode 100644 index 1e16d06..0000000 --- a/Backend/ERPCore/Migrations/20260825000000_FixProductionTemplatesSubNavItemIdConflict.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - /// Repairs a collision baked into migration history: 20260818090139_AddProductionNavPermissions - /// inserted "production.templates" as sub_nav_items row 24, then - /// 20260820100345_AddNotificationConfigModulePreferences reused the same literal id 24 for - /// "settings.notification-config" via a raw-SQL INSERT ... ON CONFLICT ("SubNavItemId") DO - /// UPDATE, silently overwriting the production.templates row instead of inserting a new - /// one. Row 24 now correctly holds notification-config; this migration re-creates the lost - /// production.templates row under a fresh id (27, matching the corrected seed data in - /// SubNavItemConfiguration/PermissionConfiguration) and repoints the NAV:production.templates - /// permission (id 36) at it. - /// - public partial class FixProductionTemplatesSubNavItemIdConflict : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.Sql(""" - INSERT INTO sub_nav_items ("SubNavItemId", "NavItemId", "Code", "Href", "Icon", "Label", "SortOrder") - VALUES (27, 14, 'production.templates', '/dashboard/production/templates', NULL, 'Templates', 1) - ON CONFLICT ("SubNavItemId") DO NOTHING; - """); - - migrationBuilder.Sql(""" - UPDATE permissions SET "SubNavItemId" = 27 WHERE "PermissionId" = 36; - """); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.Sql(""" - UPDATE permissions SET "SubNavItemId" = 24 WHERE "PermissionId" = 36; - """); - - migrationBuilder.Sql(""" - DELETE FROM sub_nav_items WHERE "SubNavItemId" = 27; - """); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260831060800_AddPurchaseInvoices.Designer.cs b/Backend/ERPCore/Migrations/20260831060800_AddPurchaseInvoices.Designer.cs deleted file mode 100644 index 54830fd..0000000 --- a/Backend/ERPCore/Migrations/20260831060800_AddPurchaseInvoices.Designer.cs +++ /dev/null @@ -1,7860 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260831060800_AddPurchaseInvoices")] - partial class AddPurchaseInvoices - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 3, - Code = "vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - SortOrder = 3, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:vendors", - NavItemId = 3 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260831060800_AddPurchaseInvoices.cs b/Backend/ERPCore/Migrations/20260831060800_AddPurchaseInvoices.cs deleted file mode 100644 index 768f560..0000000 --- a/Backend/ERPCore/Migrations/20260831060800_AddPurchaseInvoices.cs +++ /dev/null @@ -1,303 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddPurchaseInvoices : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "grn_payments"); - - migrationBuilder.DropColumn( - name: "BalanceAmount", - table: "grns"); - - migrationBuilder.DropColumn( - name: "PaidAmount", - table: "grns"); - - migrationBuilder.AddColumn( - name: "PurchaseInvoiceId", - table: "grns", - type: "integer", - nullable: true); - - migrationBuilder.CreateTable( - name: "purchase_invoices", - columns: table => new - { - PurchaseInvoiceId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - DocNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: false), - VendorInvoiceNo = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - VendorInvoiceDate = table.Column(type: "timestamp with time zone", nullable: false), - VendorId = table.Column(type: "integer", nullable: false), - VendorSnapshotName = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - VendorSnapshotTaxNo = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Draft"), - Subtotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - VatTotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - GrandTotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - PaidAmount = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - BalanceAmount = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - GlJournalNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: true), - GlPostedAt = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_purchase_invoices", x => x.PurchaseInvoiceId); - table.ForeignKey( - name: "FK_purchase_invoices_users_CreatedBy", - column: x => x.CreatedBy, - principalTable: "users", - principalColumn: "UserId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_purchase_invoices_vendors_VendorId", - column: x => x.VendorId, - principalTable: "vendors", - principalColumn: "VendorId", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "purchase_invoice_lines", - columns: table => new - { - PurchaseInvoiceLineId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - PurchaseInvoiceId = table.Column(type: "integer", nullable: false), - GrnId = table.Column(type: "integer", nullable: false), - Subtotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - VatTotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - LineTotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_purchase_invoice_lines", x => x.PurchaseInvoiceLineId); - table.ForeignKey( - name: "FK_purchase_invoice_lines_grns_GrnId", - column: x => x.GrnId, - principalTable: "grns", - principalColumn: "GrnId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_purchase_invoice_lines_purchase_invoices_PurchaseInvoiceId", - column: x => x.PurchaseInvoiceId, - principalTable: "purchase_invoices", - principalColumn: "PurchaseInvoiceId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "purchase_invoice_payments", - columns: table => new - { - PurchaseInvoicePaymentId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - PurchaseInvoiceId = table.Column(type: "integer", nullable: false), - Amount = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - PaymentDate = table.Column(type: "timestamp with time zone", nullable: false), - GlBankAccountId = table.Column(type: "bigint", nullable: false), - BankAccountName = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Reference = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), - GlJournalNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: true), - CreatedBy = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_purchase_invoice_payments", x => x.PurchaseInvoicePaymentId); - table.ForeignKey( - name: "FK_purchase_invoice_payments_purchase_invoices_PurchaseInvoice~", - column: x => x.PurchaseInvoiceId, - principalTable: "purchase_invoices", - principalColumn: "PurchaseInvoiceId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_purchase_invoice_payments_users_CreatedBy", - column: x => x.CreatedBy, - principalTable: "users", - principalColumn: "UserId", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.InsertData( - table: "sub_nav_items", - columns: new[] { "SubNavItemId", "Code", "Href", "Icon", "Label", "NavItemId", "SortOrder" }, - values: new object[] { 28, "procurement.purchase-invoices", "/dashboard/procurement/purchase-invoices", null, "Purchase Invoices", 4, 5 }); - - migrationBuilder.InsertData( - table: "permissions", - columns: new[] { "PermissionId", "Code", "NavItemId", "SubNavItemId" }, - values: new object[] { 39, "NAV:procurement.purchase-invoices", null, 28 }); - - migrationBuilder.CreateIndex( - name: "IX_grns_PurchaseInvoiceId", - table: "grns", - column: "PurchaseInvoiceId"); - - migrationBuilder.CreateIndex( - name: "IX_purchase_invoice_lines_GrnId", - table: "purchase_invoice_lines", - column: "GrnId", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_purchase_invoice_lines_PurchaseInvoiceId", - table: "purchase_invoice_lines", - column: "PurchaseInvoiceId"); - - migrationBuilder.CreateIndex( - name: "IX_purchase_invoice_payments_CreatedBy", - table: "purchase_invoice_payments", - column: "CreatedBy"); - - migrationBuilder.CreateIndex( - name: "IX_purchase_invoice_payments_PurchaseInvoiceId", - table: "purchase_invoice_payments", - column: "PurchaseInvoiceId"); - - migrationBuilder.CreateIndex( - name: "IX_purchase_invoices_CreatedBy", - table: "purchase_invoices", - column: "CreatedBy"); - - migrationBuilder.CreateIndex( - name: "IX_purchase_invoices_DocNo", - table: "purchase_invoices", - column: "DocNo", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_purchase_invoices_Status", - table: "purchase_invoices", - column: "Status"); - - migrationBuilder.CreateIndex( - name: "IX_purchase_invoices_VendorId", - table: "purchase_invoices", - column: "VendorId"); - - migrationBuilder.CreateIndex( - name: "IX_purchase_invoices_VendorId_VendorInvoiceNo", - table: "purchase_invoices", - columns: new[] { "VendorId", "VendorInvoiceNo" }); - - migrationBuilder.AddForeignKey( - name: "FK_grns_purchase_invoices_PurchaseInvoiceId", - table: "grns", - column: "PurchaseInvoiceId", - principalTable: "purchase_invoices", - principalColumn: "PurchaseInvoiceId", - onDelete: ReferentialAction.Restrict); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_grns_purchase_invoices_PurchaseInvoiceId", - table: "grns"); - - migrationBuilder.DropTable( - name: "purchase_invoice_lines"); - - migrationBuilder.DropTable( - name: "purchase_invoice_payments"); - - migrationBuilder.DropTable( - name: "purchase_invoices"); - - migrationBuilder.DropIndex( - name: "IX_grns_PurchaseInvoiceId", - table: "grns"); - - migrationBuilder.DeleteData( - table: "permissions", - keyColumn: "PermissionId", - keyValue: 39); - - migrationBuilder.DeleteData( - table: "sub_nav_items", - keyColumn: "SubNavItemId", - keyValue: 28); - - migrationBuilder.DropColumn( - name: "PurchaseInvoiceId", - table: "grns"); - - migrationBuilder.AddColumn( - name: "BalanceAmount", - table: "grns", - type: "numeric(18,4)", - precision: 18, - scale: 4, - nullable: false, - defaultValue: 0m); - - migrationBuilder.AddColumn( - name: "PaidAmount", - table: "grns", - type: "numeric(18,4)", - precision: 18, - scale: 4, - nullable: false, - defaultValue: 0m); - - migrationBuilder.CreateTable( - name: "grn_payments", - columns: table => new - { - GrnPaymentId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - CreatedBy = table.Column(type: "integer", nullable: false), - GrnId = table.Column(type: "integer", nullable: false), - Amount = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - BankAccountName = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - GlBankAccountId = table.Column(type: "bigint", nullable: false), - GlJournalNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: true), - PaymentDate = table.Column(type: "timestamp with time zone", nullable: false), - Reference = table.Column(type: "character varying(100)", maxLength: 100, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_grn_payments", x => x.GrnPaymentId); - table.ForeignKey( - name: "FK_grn_payments_grns_GrnId", - column: x => x.GrnId, - principalTable: "grns", - principalColumn: "GrnId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_grn_payments_users_CreatedBy", - column: x => x.CreatedBy, - principalTable: "users", - principalColumn: "UserId", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_grn_payments_CreatedBy", - table: "grn_payments", - column: "CreatedBy"); - - migrationBuilder.CreateIndex( - name: "IX_grn_payments_GrnId", - table: "grn_payments", - column: "GrnId"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260901104702_AddBranchPhoneNumberAndCodeAutogen.Designer.cs b/Backend/ERPCore/Migrations/20260901104702_AddBranchPhoneNumberAndCodeAutogen.Designer.cs deleted file mode 100644 index d13444b..0000000 --- a/Backend/ERPCore/Migrations/20260901104702_AddBranchPhoneNumberAndCodeAutogen.Designer.cs +++ /dev/null @@ -1,7880 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260901104702_AddBranchPhoneNumberAndCodeAutogen")] - partial class AddBranchPhoneNumberAndCodeAutogen - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 3, - Code = "vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - SortOrder = 3, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:vendors", - NavItemId = 3 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260901104702_AddBranchPhoneNumberAndCodeAutogen.cs b/Backend/ERPCore/Migrations/20260901104702_AddBranchPhoneNumberAndCodeAutogen.cs deleted file mode 100644 index 064b486..0000000 --- a/Backend/ERPCore/Migrations/20260901104702_AddBranchPhoneNumberAndCodeAutogen.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddBranchPhoneNumberAndCodeAutogen : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "PhoneNumber", - table: "hr_branches", - type: "character varying(30)", - maxLength: 30, - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "PhoneNumber", - table: "hr_branches"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260901120000_AddSettingsBranchesNavItem.Designer.cs b/Backend/ERPCore/Migrations/20260901120000_AddSettingsBranchesNavItem.Designer.cs deleted file mode 100644 index 7a84c1c..0000000 --- a/Backend/ERPCore/Migrations/20260901120000_AddSettingsBranchesNavItem.Designer.cs +++ /dev/null @@ -1,7876 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260901120000_AddSettingsBranchesNavItem")] - partial class AddSettingsBranchesNavItem - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 3, - Code = "vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - SortOrder = 3, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:vendors", - NavItemId = 3 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260901120000_AddSettingsBranchesNavItem.cs b/Backend/ERPCore/Migrations/20260901120000_AddSettingsBranchesNavItem.cs deleted file mode 100644 index e0f987c..0000000 --- a/Backend/ERPCore/Migrations/20260901120000_AddSettingsBranchesNavItem.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddSettingsBranchesNavItem : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.InsertData( - table: "sub_nav_items", - columns: new[] { "SubNavItemId", "Code", "Href", "Icon", "Label", "NavItemId", "SortOrder" }, - values: new object[] { 29, "settings.branches", "/dashboard/settings/branches", null, "Branches", 9, 0 }); - - migrationBuilder.InsertData( - table: "permissions", - columns: new[] { "PermissionId", "Code", "NavItemId", "SubNavItemId" }, - values: new object[] { 40, "NAV:settings.branches", null, 29 }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DeleteData( - table: "permissions", - keyColumn: "PermissionId", - keyValue: 40); - - migrationBuilder.DeleteData( - table: "sub_nav_items", - keyColumn: "SubNavItemId", - keyValue: 29); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260902055505_MakeEmployeeBranchRequired.Designer.cs b/Backend/ERPCore/Migrations/20260902055505_MakeEmployeeBranchRequired.Designer.cs deleted file mode 100644 index 1d98e50..0000000 --- a/Backend/ERPCore/Migrations/20260902055505_MakeEmployeeBranchRequired.Designer.cs +++ /dev/null @@ -1,7881 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260902055505_MakeEmployeeBranchRequired")] - partial class MakeEmployeeBranchRequired - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 3, - Code = "vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - SortOrder = 3, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:vendors", - NavItemId = 3 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260902055505_MakeEmployeeBranchRequired.cs b/Backend/ERPCore/Migrations/20260902055505_MakeEmployeeBranchRequired.cs deleted file mode 100644 index 6fc0c39..0000000 --- a/Backend/ERPCore/Migrations/20260902055505_MakeEmployeeBranchRequired.cs +++ /dev/null @@ -1,50 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class MakeEmployeeBranchRequired : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - // Branch becomes a required field on Employee going forward. Any pre-existing - // employee left with no branch is backfilled to a "Main Branch" placeholder - // (created only if it doesn't already exist) so the NOT NULL below never fails - // on live data. - migrationBuilder.Sql(@" - INSERT INTO hr_branches (""Code"", ""Name"", ""Status"", ""CreatedAt"") - SELECT 'BR-000', 'Main Branch', 'Active', now() - WHERE NOT EXISTS (SELECT 1 FROM hr_branches WHERE ""Code"" = 'BR-000') - AND EXISTS (SELECT 1 FROM hr_employees WHERE ""BranchId"" IS NULL); - - UPDATE hr_employees - SET ""BranchId"" = (SELECT ""BranchId"" FROM hr_branches WHERE ""Code"" = 'BR-000') - WHERE ""BranchId"" IS NULL; - "); - - migrationBuilder.AlterColumn( - name: "BranchId", - table: "hr_employees", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "BranchId", - table: "hr_employees", - type: "integer", - nullable: true, - oldClrType: typeof(int), - oldType: "integer"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260902094609_AddWarehouseBranch.Designer.cs b/Backend/ERPCore/Migrations/20260902094609_AddWarehouseBranch.Designer.cs deleted file mode 100644 index 6ee7e0b..0000000 --- a/Backend/ERPCore/Migrations/20260902094609_AddWarehouseBranch.Designer.cs +++ /dev/null @@ -1,7897 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260902094609_AddWarehouseBranch")] - partial class AddWarehouseBranch - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 3, - Code = "vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - SortOrder = 3, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:vendors", - NavItemId = 3 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260902094609_AddWarehouseBranch.cs b/Backend/ERPCore/Migrations/20260902094609_AddWarehouseBranch.cs deleted file mode 100644 index 7b332d9..0000000 --- a/Backend/ERPCore/Migrations/20260902094609_AddWarehouseBranch.cs +++ /dev/null @@ -1,73 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddWarehouseBranch : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "BranchId", - table: "warehouses", - type: "integer", - nullable: true); - - // Backfill any pre-existing warehouse onto the same "Main Branch" placeholder - // used by the earlier MakeEmployeeBranchRequired migration (created only if it - // doesn't already exist) — keeps a single de-facto default rather than minting - // a second one — before the column is locked to NOT NULL below. - migrationBuilder.Sql(@" - INSERT INTO hr_branches (""Code"", ""Name"", ""Status"", ""CreatedAt"") - SELECT 'BR-000', 'Main Branch', 'Active', now() - WHERE NOT EXISTS (SELECT 1 FROM hr_branches WHERE ""Code"" = 'BR-000') - AND EXISTS (SELECT 1 FROM warehouses WHERE ""BranchId"" IS NULL); - - UPDATE warehouses - SET ""BranchId"" = (SELECT ""BranchId"" FROM hr_branches WHERE ""Code"" = 'BR-000') - WHERE ""BranchId"" IS NULL; - "); - - migrationBuilder.AlterColumn( - name: "BranchId", - table: "warehouses", - type: "integer", - nullable: false, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true); - - migrationBuilder.CreateIndex( - name: "IX_warehouses_BranchId", - table: "warehouses", - column: "BranchId"); - - migrationBuilder.AddForeignKey( - name: "FK_warehouses_hr_branches_BranchId", - table: "warehouses", - column: "BranchId", - principalTable: "hr_branches", - principalColumn: "BranchId", - onDelete: ReferentialAction.Restrict); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_warehouses_hr_branches_BranchId", - table: "warehouses"); - - migrationBuilder.DropIndex( - name: "IX_warehouses_BranchId", - table: "warehouses"); - - migrationBuilder.DropColumn( - name: "BranchId", - table: "warehouses"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260902095449_AddBranchConfig.Designer.cs b/Backend/ERPCore/Migrations/20260902095449_AddBranchConfig.Designer.cs deleted file mode 100644 index 0a86244..0000000 --- a/Backend/ERPCore/Migrations/20260902095449_AddBranchConfig.Designer.cs +++ /dev/null @@ -1,7939 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260902095449_AddBranchConfig")] - partial class AddBranchConfig - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 3, - Code = "vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - SortOrder = 3, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:vendors", - NavItemId = 3 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260902095449_AddBranchConfig.cs b/Backend/ERPCore/Migrations/20260902095449_AddBranchConfig.cs deleted file mode 100644 index c13db76..0000000 --- a/Backend/ERPCore/Migrations/20260902095449_AddBranchConfig.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddBranchConfig : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "branch_config", - columns: table => new - { - ConfigId = table.Column(type: "integer", nullable: false), - BranchingEnabled = table.Column(type: "boolean", nullable: false, defaultValue: true), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - UpdatedBy = table.Column(type: "integer", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_branch_config", x => x.ConfigId); - table.CheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - table.ForeignKey( - name: "FK_branch_config_users_UpdatedBy", - column: x => x.UpdatedBy, - principalTable: "users", - principalColumn: "UserId", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_branch_config_UpdatedBy", - table: "branch_config", - column: "UpdatedBy"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "branch_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260908101847_AddBranchIdToDocuments.Designer.cs b/Backend/ERPCore/Migrations/20260908101847_AddBranchIdToDocuments.Designer.cs deleted file mode 100644 index cfb2eca..0000000 --- a/Backend/ERPCore/Migrations/20260908101847_AddBranchIdToDocuments.Designer.cs +++ /dev/null @@ -1,8004 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260908101847_AddBranchIdToDocuments")] - partial class AddBranchIdToDocuments - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 3, - Code = "vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - SortOrder = 3, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:vendors", - NavItemId = 3 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260908101847_AddBranchIdToDocuments.cs b/Backend/ERPCore/Migrations/20260908101847_AddBranchIdToDocuments.cs deleted file mode 100644 index b50312d..0000000 --- a/Backend/ERPCore/Migrations/20260908101847_AddBranchIdToDocuments.cs +++ /dev/null @@ -1,199 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddBranchIdToDocuments : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "BranchId", - table: "stock_transfers", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "BranchId", - table: "stock_counts", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "BranchId", - table: "stock_adjustments", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "BranchId", - table: "sales_invoices", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "BranchId", - table: "grns", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.CreateIndex( - name: "IX_stock_transfers_BranchId", - table: "stock_transfers", - column: "BranchId"); - - migrationBuilder.CreateIndex( - name: "IX_stock_counts_BranchId", - table: "stock_counts", - column: "BranchId"); - - migrationBuilder.CreateIndex( - name: "IX_stock_adjustments_BranchId", - table: "stock_adjustments", - column: "BranchId"); - - migrationBuilder.CreateIndex( - name: "IX_sales_invoices_BranchId", - table: "sales_invoices", - column: "BranchId"); - - migrationBuilder.CreateIndex( - name: "IX_grns_BranchId", - table: "grns", - column: "BranchId"); - - // Backfill from each document's existing warehouse — warehouses were the sole - // branch anchor until now, so this preserves current branch assignment exactly. - // (Warehouse.BranchId is NOT NULL, so every row is resolvable; the WHERE BranchId = 0 - // guard just keeps this idempotent if the migration is ever re-run against partial state.) - migrationBuilder.Sql(@" - UPDATE grns g SET ""BranchId"" = w.""BranchId"" - FROM warehouses w WHERE w.""WarehouseId"" = g.""WarehouseId"" AND g.""BranchId"" = 0; - - UPDATE sales_invoices x SET ""BranchId"" = w.""BranchId"" - FROM warehouses w WHERE w.""WarehouseId"" = x.""WarehouseId"" AND x.""BranchId"" = 0; - - UPDATE stock_counts c SET ""BranchId"" = w.""BranchId"" - FROM warehouses w WHERE w.""WarehouseId"" = c.""WarehouseId"" AND c.""BranchId"" = 0; - - UPDATE stock_adjustments a SET ""BranchId"" = w.""BranchId"" - FROM warehouses w WHERE w.""WarehouseId"" = a.""WarehouseId"" AND a.""BranchId"" = 0; - - UPDATE stock_transfers t SET ""BranchId"" = w.""BranchId"" - FROM warehouses w WHERE w.""WarehouseId"" = t.""SrcWarehouseId"" AND t.""BranchId"" = 0; - "); - - migrationBuilder.AddForeignKey( - name: "FK_grns_hr_branches_BranchId", - table: "grns", - column: "BranchId", - principalTable: "hr_branches", - principalColumn: "BranchId", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_sales_invoices_hr_branches_BranchId", - table: "sales_invoices", - column: "BranchId", - principalTable: "hr_branches", - principalColumn: "BranchId", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_stock_adjustments_hr_branches_BranchId", - table: "stock_adjustments", - column: "BranchId", - principalTable: "hr_branches", - principalColumn: "BranchId", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_stock_counts_hr_branches_BranchId", - table: "stock_counts", - column: "BranchId", - principalTable: "hr_branches", - principalColumn: "BranchId", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_stock_transfers_hr_branches_BranchId", - table: "stock_transfers", - column: "BranchId", - principalTable: "hr_branches", - principalColumn: "BranchId", - onDelete: ReferentialAction.Restrict); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_grns_hr_branches_BranchId", - table: "grns"); - - migrationBuilder.DropForeignKey( - name: "FK_sales_invoices_hr_branches_BranchId", - table: "sales_invoices"); - - migrationBuilder.DropForeignKey( - name: "FK_stock_adjustments_hr_branches_BranchId", - table: "stock_adjustments"); - - migrationBuilder.DropForeignKey( - name: "FK_stock_counts_hr_branches_BranchId", - table: "stock_counts"); - - migrationBuilder.DropForeignKey( - name: "FK_stock_transfers_hr_branches_BranchId", - table: "stock_transfers"); - - migrationBuilder.DropIndex( - name: "IX_stock_transfers_BranchId", - table: "stock_transfers"); - - migrationBuilder.DropIndex( - name: "IX_stock_counts_BranchId", - table: "stock_counts"); - - migrationBuilder.DropIndex( - name: "IX_stock_adjustments_BranchId", - table: "stock_adjustments"); - - migrationBuilder.DropIndex( - name: "IX_sales_invoices_BranchId", - table: "sales_invoices"); - - migrationBuilder.DropIndex( - name: "IX_grns_BranchId", - table: "grns"); - - migrationBuilder.DropColumn( - name: "BranchId", - table: "stock_transfers"); - - migrationBuilder.DropColumn( - name: "BranchId", - table: "stock_counts"); - - migrationBuilder.DropColumn( - name: "BranchId", - table: "stock_adjustments"); - - migrationBuilder.DropColumn( - name: "BranchId", - table: "sales_invoices"); - - migrationBuilder.DropColumn( - name: "BranchId", - table: "grns"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260909101932_MoveVendorsUnderProcurement.Designer.cs b/Backend/ERPCore/Migrations/20260909101932_MoveVendorsUnderProcurement.Designer.cs deleted file mode 100644 index 8edf598..0000000 --- a/Backend/ERPCore/Migrations/20260909101932_MoveVendorsUnderProcurement.Designer.cs +++ /dev/null @@ -1,8005 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260909101932_MoveVendorsUnderProcurement")] - partial class MoveVendorsUnderProcurement - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260909101932_MoveVendorsUnderProcurement.cs b/Backend/ERPCore/Migrations/20260909101932_MoveVendorsUnderProcurement.cs deleted file mode 100644 index 094a6ce..0000000 --- a/Backend/ERPCore/Migrations/20260909101932_MoveVendorsUnderProcurement.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class MoveVendorsUnderProcurement : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - // Order matters: Permission.NavItemId cascades on delete, so the permission row must be - // repointed off NavItemId 3 (via the new sub_nav_item) before that nav_item is deleted — - // otherwise the delete cascades and removes the permission row first. - migrationBuilder.InsertData( - table: "sub_nav_items", - columns: new[] { "SubNavItemId", "Code", "Href", "Icon", "Label", "NavItemId", "SortOrder" }, - values: new object[] { 30, "procurement.vendors", "/dashboard/vendors", null, "Vendors", 4, 0 }); - - migrationBuilder.UpdateData( - table: "permissions", - keyColumn: "PermissionId", - keyValue: 3, - columns: new[] { "Code", "NavItemId", "SubNavItemId" }, - values: new object[] { "NAV:procurement.vendors", null, 30 }); - - migrationBuilder.DeleteData( - table: "nav_items", - keyColumn: "NavItemId", - keyValue: 3); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DeleteData( - table: "sub_nav_items", - keyColumn: "SubNavItemId", - keyValue: 30); - - migrationBuilder.InsertData( - table: "nav_items", - columns: new[] { "NavItemId", "Code", "Href", "Icon", "Label", "SortOrder", "Status" }, - values: new object[] { 3, "vendors", "/dashboard/vendors", null, "Vendors", 3, "Active" }); - - migrationBuilder.UpdateData( - table: "permissions", - keyColumn: "PermissionId", - keyValue: 3, - columns: new[] { "Code", "NavItemId", "SubNavItemId" }, - values: new object[] { "NAV:vendors", 3, null }); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260909102452_AddStockSubNavItems.Designer.cs b/Backend/ERPCore/Migrations/20260909102452_AddStockSubNavItems.Designer.cs deleted file mode 100644 index dda393c..0000000 --- a/Backend/ERPCore/Migrations/20260909102452_AddStockSubNavItems.Designer.cs +++ /dev/null @@ -1,8133 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260909102452_AddStockSubNavItems")] - partial class AddStockSubNavItems - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260909102452_AddStockSubNavItems.cs b/Backend/ERPCore/Migrations/20260909102452_AddStockSubNavItems.cs deleted file mode 100644 index b03b2ed..0000000 --- a/Backend/ERPCore/Migrations/20260909102452_AddStockSubNavItems.cs +++ /dev/null @@ -1,130 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional - -namespace ERPCore.Migrations -{ - /// - public partial class AddStockSubNavItems : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.InsertData( - table: "sub_nav_items", - columns: new[] { "SubNavItemId", "Code", "Href", "Icon", "Label", "NavItemId", "SortOrder" }, - values: new object[,] - { - { 31, "stock.ledger", "/dashboard/stock/ledger", null, "Stock Ledger", 6, 1 }, - { 32, "stock.enquiry", "/dashboard/stock/enquiry", null, "Stock Enquiry", 6, 2 }, - { 33, "stock.valuation", "/dashboard/stock/valuation", null, "Valuation", 6, 3 }, - { 34, "stock.transfers", "/dashboard/stock/transfers", null, "Transfers", 6, 4 }, - { 35, "stock.adjustments", "/dashboard/stock/adjustments", null, "Adjustments", 6, 5 }, - { 36, "stock.counts", "/dashboard/stock/counts", null, "Counts", 6, 6 }, - { 37, "stock.reorder-alerts", "/dashboard/stock/reorder-alerts", null, "Reorder Alerts", 6, 7 }, - { 38, "stock.wastage", "/dashboard/stock/wastage", null, "Wastage", 6, 8 } - }); - - migrationBuilder.InsertData( - table: "permissions", - columns: new[] { "PermissionId", "Code", "NavItemId", "SubNavItemId" }, - values: new object[,] - { - { 41, "NAV:stock.ledger", null, 31 }, - { 42, "NAV:stock.enquiry", null, 32 }, - { 43, "NAV:stock.valuation", null, 33 }, - { 44, "NAV:stock.transfers", null, 34 }, - { 45, "NAV:stock.adjustments", null, 35 }, - { 46, "NAV:stock.counts", null, 36 }, - { 47, "NAV:stock.reorder-alerts", null, 37 }, - { 48, "NAV:stock.wastage", null, 38 } - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DeleteData( - table: "permissions", - keyColumn: "PermissionId", - keyValue: 41); - - migrationBuilder.DeleteData( - table: "permissions", - keyColumn: "PermissionId", - keyValue: 42); - - migrationBuilder.DeleteData( - table: "permissions", - keyColumn: "PermissionId", - keyValue: 43); - - migrationBuilder.DeleteData( - table: "permissions", - keyColumn: "PermissionId", - keyValue: 44); - - migrationBuilder.DeleteData( - table: "permissions", - keyColumn: "PermissionId", - keyValue: 45); - - migrationBuilder.DeleteData( - table: "permissions", - keyColumn: "PermissionId", - keyValue: 46); - - migrationBuilder.DeleteData( - table: "permissions", - keyColumn: "PermissionId", - keyValue: 47); - - migrationBuilder.DeleteData( - table: "permissions", - keyColumn: "PermissionId", - keyValue: 48); - - migrationBuilder.DeleteData( - table: "sub_nav_items", - keyColumn: "SubNavItemId", - keyValue: 31); - - migrationBuilder.DeleteData( - table: "sub_nav_items", - keyColumn: "SubNavItemId", - keyValue: 32); - - migrationBuilder.DeleteData( - table: "sub_nav_items", - keyColumn: "SubNavItemId", - keyValue: 33); - - migrationBuilder.DeleteData( - table: "sub_nav_items", - keyColumn: "SubNavItemId", - keyValue: 34); - - migrationBuilder.DeleteData( - table: "sub_nav_items", - keyColumn: "SubNavItemId", - keyValue: 35); - - migrationBuilder.DeleteData( - table: "sub_nav_items", - keyColumn: "SubNavItemId", - keyValue: 36); - - migrationBuilder.DeleteData( - table: "sub_nav_items", - keyColumn: "SubNavItemId", - keyValue: 37); - - migrationBuilder.DeleteData( - table: "sub_nav_items", - keyColumn: "SubNavItemId", - keyValue: 38); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260909103002_AddSalesSubNavItems.Designer.cs b/Backend/ERPCore/Migrations/20260909103002_AddSalesSubNavItems.Designer.cs deleted file mode 100644 index 7b41738..0000000 --- a/Backend/ERPCore/Migrations/20260909103002_AddSalesSubNavItems.Designer.cs +++ /dev/null @@ -1,8187 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260909103002_AddSalesSubNavItems")] - partial class AddSalesSubNavItems - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260909103002_AddSalesSubNavItems.cs b/Backend/ERPCore/Migrations/20260909103002_AddSalesSubNavItems.cs deleted file mode 100644 index 1482273..0000000 --- a/Backend/ERPCore/Migrations/20260909103002_AddSalesSubNavItems.cs +++ /dev/null @@ -1,94 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional - -namespace ERPCore.Migrations -{ - /// - public partial class AddSalesSubNavItems : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.InsertData( - table: "permissions", - columns: new[] { "PermissionId", "Code", "NavItemId", "SubNavItemId" }, - values: new object[] { 49, "NAV:sales.bundle-templates", null, 23 }); - - migrationBuilder.UpdateData( - table: "sub_nav_items", - keyColumn: "SubNavItemId", - keyValue: 23, - columns: new[] { "Code", "Href", "Label", "SortOrder" }, - values: new object[] { "sales.bundle-templates", "/dashboard/sales/bundles/templates", "Bundle Templates", 2 }); - - migrationBuilder.InsertData( - table: "sub_nav_items", - columns: new[] { "SubNavItemId", "Code", "Href", "Icon", "Label", "NavItemId", "SortOrder" }, - values: new object[,] - { - { 40, "sales.invoices", "/dashboard/sales/invoices", null, "Sales", 13, 1 }, - { 41, "sales.free-issues", "/dashboard/sales/free-issues", null, "Free Issues", 13, 3 }, - { 42, "sales.day-end", "/dashboard/sales/day-end", null, "Day End", 13, 4 } - }); - - migrationBuilder.InsertData( - table: "permissions", - columns: new[] { "PermissionId", "Code", "NavItemId", "SubNavItemId" }, - values: new object[,] - { - { 50, "NAV:sales.invoices", null, 40 }, - { 51, "NAV:sales.free-issues", null, 41 }, - { 52, "NAV:sales.day-end", null, 42 } - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DeleteData( - table: "permissions", - keyColumn: "PermissionId", - keyValue: 49); - - migrationBuilder.DeleteData( - table: "permissions", - keyColumn: "PermissionId", - keyValue: 50); - - migrationBuilder.DeleteData( - table: "permissions", - keyColumn: "PermissionId", - keyValue: 51); - - migrationBuilder.DeleteData( - table: "permissions", - keyColumn: "PermissionId", - keyValue: 52); - - migrationBuilder.DeleteData( - table: "sub_nav_items", - keyColumn: "SubNavItemId", - keyValue: 40); - - migrationBuilder.DeleteData( - table: "sub_nav_items", - keyColumn: "SubNavItemId", - keyValue: 41); - - migrationBuilder.DeleteData( - table: "sub_nav_items", - keyColumn: "SubNavItemId", - keyValue: 42); - - migrationBuilder.UpdateData( - table: "sub_nav_items", - keyColumn: "SubNavItemId", - keyValue: 23, - columns: new[] { "Code", "Href", "Label", "SortOrder" }, - values: new object[] { "sales.bundle-sales", "/dashboard/sales/bundles", "Bundle Sales", 1 }); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260910092607_AddLoginActivity.Designer.cs b/Backend/ERPCore/Migrations/20260910092607_AddLoginActivity.Designer.cs deleted file mode 100644 index 12a7515..0000000 --- a/Backend/ERPCore/Migrations/20260910092607_AddLoginActivity.Designer.cs +++ /dev/null @@ -1,8231 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260910092607_AddLoginActivity")] - partial class AddLoginActivity - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260910092607_AddLoginActivity.cs b/Backend/ERPCore/Migrations/20260910092607_AddLoginActivity.cs deleted file mode 100644 index 77853e2..0000000 --- a/Backend/ERPCore/Migrations/20260910092607_AddLoginActivity.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddLoginActivity : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "login_activities", - columns: table => new - { - LoginActivityId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - UserId = table.Column(type: "integer", nullable: false), - IpAddress = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), - UserAgent = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), - DeviceLabel = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), - LoginAt = table.Column(type: "timestamp with time zone", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_login_activities", x => x.LoginActivityId); - table.ForeignKey( - name: "FK_login_activities_users_UserId", - column: x => x.UserId, - principalTable: "users", - principalColumn: "UserId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_login_activities_UserId_LoginAt", - table: "login_activities", - columns: new[] { "UserId", "LoginAt" }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "login_activities"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260914061147_AddNotificationFeed.Designer.cs b/Backend/ERPCore/Migrations/20260914061147_AddNotificationFeed.Designer.cs deleted file mode 100644 index d9e9544..0000000 --- a/Backend/ERPCore/Migrations/20260914061147_AddNotificationFeed.Designer.cs +++ /dev/null @@ -1,8324 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260914061147_AddNotificationFeed")] - partial class AddNotificationFeed - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260914061147_AddNotificationFeed.cs b/Backend/ERPCore/Migrations/20260914061147_AddNotificationFeed.cs deleted file mode 100644 index 8b06707..0000000 --- a/Backend/ERPCore/Migrations/20260914061147_AddNotificationFeed.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddNotificationFeed : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "notifications", - columns: table => new - { - NotificationId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ModuleKey = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), - Title = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Message = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: false), - RelatedEntityType = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), - RelatedEntityId = table.Column(type: "integer", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_notifications", x => x.NotificationId); - }); - - migrationBuilder.CreateTable( - name: "notification_recipients", - columns: table => new - { - NotificationRecipientId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - NotificationId = table.Column(type: "integer", nullable: false), - UserId = table.Column(type: "integer", nullable: false), - IsRead = table.Column(type: "boolean", nullable: false), - ReadAt = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_notification_recipients", x => x.NotificationRecipientId); - table.ForeignKey( - name: "FK_notification_recipients_notifications_NotificationId", - column: x => x.NotificationId, - principalTable: "notifications", - principalColumn: "NotificationId", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_notification_recipients_users_UserId", - column: x => x.UserId, - principalTable: "users", - principalColumn: "UserId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_notification_recipients_NotificationId", - table: "notification_recipients", - column: "NotificationId"); - - migrationBuilder.CreateIndex( - name: "IX_notification_recipients_UserId_IsRead_NotificationId", - table: "notification_recipients", - columns: new[] { "UserId", "IsRead", "NotificationId" }); - - migrationBuilder.CreateIndex( - name: "IX_notifications_CreatedAt", - table: "notifications", - column: "CreatedAt"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "notification_recipients"); - - migrationBuilder.DropTable( - name: "notifications"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260914061430_AddUomLifecycleColumnsLocal.Designer.cs b/Backend/ERPCore/Migrations/20260914061430_AddUomLifecycleColumnsLocal.Designer.cs deleted file mode 100644 index e75e99b..0000000 --- a/Backend/ERPCore/Migrations/20260914061430_AddUomLifecycleColumnsLocal.Designer.cs +++ /dev/null @@ -1,7954 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260914061430_AddUomLifecycleColumnsLocal")] - partial class AddUomLifecycleColumnsLocal - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 3, - Code = "vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - SortOrder = 3, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:vendors", - NavItemId = 3 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-sales", - Href = "/dashboard/sales/bundles", - Label = "Bundle Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260914061430_AddUomLifecycleColumnsLocal.cs b/Backend/ERPCore/Migrations/20260914061430_AddUomLifecycleColumnsLocal.cs deleted file mode 100644 index 4c66e9c..0000000 --- a/Backend/ERPCore/Migrations/20260914061430_AddUomLifecycleColumnsLocal.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddUomLifecycleColumnsLocal : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "CreatedAt", - table: "uoms", - type: "timestamp with time zone", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); - - migrationBuilder.AddColumn( - name: "Status", - table: "uoms", - type: "character varying(20)", - maxLength: 20, - nullable: false, - defaultValue: "Active"); - - migrationBuilder.AddColumn( - name: "UpdatedAt", - table: "uoms", - type: "timestamp with time zone", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_uoms_Status", - table: "uoms", - column: "Status"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_uoms_Status", - table: "uoms"); - - migrationBuilder.DropColumn( - name: "CreatedAt", - table: "uoms"); - - migrationBuilder.DropColumn( - name: "Status", - table: "uoms"); - - migrationBuilder.DropColumn( - name: "UpdatedAt", - table: "uoms"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260915044627_AddSupportTickets.Designer.cs b/Backend/ERPCore/Migrations/20260915044627_AddSupportTickets.Designer.cs deleted file mode 100644 index 27bb805..0000000 --- a/Backend/ERPCore/Migrations/20260915044627_AddSupportTickets.Designer.cs +++ /dev/null @@ -1,8408 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260915044627_AddSupportTickets")] - partial class AddSupportTickets - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedByUserId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedByUserId"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260915044627_AddSupportTickets.cs b/Backend/ERPCore/Migrations/20260915044627_AddSupportTickets.cs deleted file mode 100644 index bd472e6..0000000 --- a/Backend/ERPCore/Migrations/20260915044627_AddSupportTickets.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddSupportTickets : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "support_tickets", - columns: table => new - { - TicketId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Subject = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - CreatedByUserId = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_support_tickets", x => x.TicketId); - }); - - migrationBuilder.CreateTable( - name: "support_ticket_messages", - columns: table => new - { - MessageId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - TicketId = table.Column(type: "integer", nullable: false), - SenderUserId = table.Column(type: "integer", nullable: false), - IsFromAdmin = table.Column(type: "boolean", nullable: false), - Message = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_support_ticket_messages", x => x.MessageId); - table.ForeignKey( - name: "FK_support_ticket_messages_support_tickets_TicketId", - column: x => x.TicketId, - principalTable: "support_tickets", - principalColumn: "TicketId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_support_ticket_messages_TicketId_CreatedAt", - table: "support_ticket_messages", - columns: new[] { "TicketId", "CreatedAt" }); - - migrationBuilder.CreateIndex( - name: "IX_support_tickets_CreatedByUserId", - table: "support_tickets", - column: "CreatedByUserId"); - - migrationBuilder.CreateIndex( - name: "IX_support_tickets_Status", - table: "support_tickets", - column: "Status"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "support_ticket_messages"); - - migrationBuilder.DropTable( - name: "support_tickets"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260915065226_RestyleSupportTicketLikeEmployee.Designer.cs b/Backend/ERPCore/Migrations/20260915065226_RestyleSupportTicketLikeEmployee.Designer.cs deleted file mode 100644 index 0b68bf4..0000000 --- a/Backend/ERPCore/Migrations/20260915065226_RestyleSupportTicketLikeEmployee.Designer.cs +++ /dev/null @@ -1,8417 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260915065226_RestyleSupportTicketLikeEmployee")] - partial class RestyleSupportTicketLikeEmployee - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260915065226_RestyleSupportTicketLikeEmployee.cs b/Backend/ERPCore/Migrations/20260915065226_RestyleSupportTicketLikeEmployee.cs deleted file mode 100644 index 9e7cb83..0000000 --- a/Backend/ERPCore/Migrations/20260915065226_RestyleSupportTicketLikeEmployee.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class RestyleSupportTicketLikeEmployee : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "CreatedByUserId", - table: "support_tickets", - newName: "CreatedBy"); - - migrationBuilder.RenameIndex( - name: "IX_support_tickets_CreatedByUserId", - table: "support_tickets", - newName: "IX_support_tickets_CreatedBy"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "support_tickets", - type: "timestamp with time zone", - nullable: true, - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone"); - - migrationBuilder.AddColumn( - name: "UpdatedBy", - table: "support_tickets", - type: "integer", - nullable: true); - - migrationBuilder.AddColumn( - name: "xmin", - table: "support_tickets", - type: "xid", - rowVersion: true, - nullable: false, - defaultValue: 0u); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "UpdatedBy", - table: "support_tickets"); - - migrationBuilder.DropColumn( - name: "xmin", - table: "support_tickets"); - - migrationBuilder.RenameColumn( - name: "CreatedBy", - table: "support_tickets", - newName: "CreatedByUserId"); - - migrationBuilder.RenameIndex( - name: "IX_support_tickets_CreatedBy", - table: "support_tickets", - newName: "IX_support_tickets_CreatedByUserId"); - - migrationBuilder.AlterColumn( - name: "UpdatedAt", - table: "support_tickets", - type: "timestamp with time zone", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - oldClrType: typeof(DateTime), - oldType: "timestamp with time zone", - oldNullable: true); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260915100820_AddWarehouseAddressPhone.Designer.cs b/Backend/ERPCore/Migrations/20260915100820_AddWarehouseAddressPhone.Designer.cs deleted file mode 100644 index cb9ec89..0000000 --- a/Backend/ERPCore/Migrations/20260915100820_AddWarehouseAddressPhone.Designer.cs +++ /dev/null @@ -1,8423 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260915100820_AddWarehouseAddressPhone")] - partial class AddWarehouseAddressPhone - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260915100820_AddWarehouseAddressPhone.cs b/Backend/ERPCore/Migrations/20260915100820_AddWarehouseAddressPhone.cs deleted file mode 100644 index 8ed6262..0000000 --- a/Backend/ERPCore/Migrations/20260915100820_AddWarehouseAddressPhone.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddWarehouseAddressPhone : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Address", - table: "warehouses", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "Phone", - table: "warehouses", - type: "text", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Address", - table: "warehouses"); - - migrationBuilder.DropColumn( - name: "Phone", - table: "warehouses"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260915102006_AddWarehouseBranchingToggle.Designer.cs b/Backend/ERPCore/Migrations/20260915102006_AddWarehouseBranchingToggle.Designer.cs deleted file mode 100644 index 376b5e7..0000000 --- a/Backend/ERPCore/Migrations/20260915102006_AddWarehouseBranchingToggle.Designer.cs +++ /dev/null @@ -1,8426 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260915102006_AddWarehouseBranchingToggle")] - partial class AddWarehouseBranchingToggle - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260915102006_AddWarehouseBranchingToggle.cs b/Backend/ERPCore/Migrations/20260915102006_AddWarehouseBranchingToggle.cs deleted file mode 100644 index 6298d07..0000000 --- a/Backend/ERPCore/Migrations/20260915102006_AddWarehouseBranchingToggle.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddWarehouseBranchingToggle : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "WarehouseBranchingEnabled", - table: "branch_config", - type: "boolean", - nullable: false, - defaultValue: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "WarehouseBranchingEnabled", - table: "branch_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260915110359_AddPurchaseOrderApprovalAudit.Designer.cs b/Backend/ERPCore/Migrations/20260915110359_AddPurchaseOrderApprovalAudit.Designer.cs deleted file mode 100644 index 7608d30..0000000 --- a/Backend/ERPCore/Migrations/20260915110359_AddPurchaseOrderApprovalAudit.Designer.cs +++ /dev/null @@ -1,8443 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260915110359_AddPurchaseOrderApprovalAudit")] - partial class AddPurchaseOrderApprovalAudit - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260915110359_AddPurchaseOrderApprovalAudit.cs b/Backend/ERPCore/Migrations/20260915110359_AddPurchaseOrderApprovalAudit.cs deleted file mode 100644 index 4cac8b4..0000000 --- a/Backend/ERPCore/Migrations/20260915110359_AddPurchaseOrderApprovalAudit.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddPurchaseOrderApprovalAudit : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "ApprovedAt", - table: "purchase_orders", - type: "timestamp with time zone", - nullable: true); - - migrationBuilder.AddColumn( - name: "ApprovedBy", - table: "purchase_orders", - type: "integer", - nullable: true); - - migrationBuilder.AddColumn( - name: "ApproverUserId", - table: "purchase_orders", - type: "integer", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_purchase_orders_ApproverUserId", - table: "purchase_orders", - column: "ApproverUserId"); - - migrationBuilder.AddForeignKey( - name: "FK_purchase_orders_users_ApproverUserId", - table: "purchase_orders", - column: "ApproverUserId", - principalTable: "users", - principalColumn: "UserId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_purchase_orders_users_ApproverUserId", - table: "purchase_orders"); - - migrationBuilder.DropIndex( - name: "IX_purchase_orders_ApproverUserId", - table: "purchase_orders"); - - migrationBuilder.DropColumn( - name: "ApprovedAt", - table: "purchase_orders"); - - migrationBuilder.DropColumn( - name: "ApprovedBy", - table: "purchase_orders"); - - migrationBuilder.DropColumn( - name: "ApproverUserId", - table: "purchase_orders"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260916051856_AddRolePermissionActions.Designer.cs b/Backend/ERPCore/Migrations/20260916051856_AddRolePermissionActions.Designer.cs deleted file mode 100644 index 62869e9..0000000 --- a/Backend/ERPCore/Migrations/20260916051856_AddRolePermissionActions.Designer.cs +++ /dev/null @@ -1,8448 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260916051856_AddRolePermissionActions")] - partial class AddRolePermissionActions - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260916051856_AddRolePermissionActions.cs b/Backend/ERPCore/Migrations/20260916051856_AddRolePermissionActions.cs deleted file mode 100644 index 061b4d0..0000000 --- a/Backend/ERPCore/Migrations/20260916051856_AddRolePermissionActions.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddRolePermissionActions : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Actions", - table: "role_permissions", - type: "integer", - nullable: false, - defaultValue: 31); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Actions", - table: "role_permissions"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260916071017_AddSalesDayEndPaidBalance.Designer.cs b/Backend/ERPCore/Migrations/20260916071017_AddSalesDayEndPaidBalance.Designer.cs deleted file mode 100644 index 16a7aee..0000000 --- a/Backend/ERPCore/Migrations/20260916071017_AddSalesDayEndPaidBalance.Designer.cs +++ /dev/null @@ -1,8456 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260916071017_AddSalesDayEndPaidBalance")] - partial class AddSalesDayEndPaidBalance - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260916071017_AddSalesDayEndPaidBalance.cs b/Backend/ERPCore/Migrations/20260916071017_AddSalesDayEndPaidBalance.cs deleted file mode 100644 index d4bbfbc..0000000 --- a/Backend/ERPCore/Migrations/20260916071017_AddSalesDayEndPaidBalance.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddSalesDayEndPaidBalance : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "BalanceTotal", - table: "sales_day_ends", - type: "numeric(18,4)", - precision: 18, - scale: 4, - nullable: false, - defaultValue: 0m); - - migrationBuilder.AddColumn( - name: "PaidTotal", - table: "sales_day_ends", - type: "numeric(18,4)", - precision: 18, - scale: 4, - nullable: false, - defaultValue: 0m); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "BalanceTotal", - table: "sales_day_ends"); - - migrationBuilder.DropColumn( - name: "PaidTotal", - table: "sales_day_ends"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260916082426_AddTaxRatesAndItemTaxRate.Designer.cs b/Backend/ERPCore/Migrations/20260916082426_AddTaxRatesAndItemTaxRate.Designer.cs deleted file mode 100644 index efae913..0000000 --- a/Backend/ERPCore/Migrations/20260916082426_AddTaxRatesAndItemTaxRate.Designer.cs +++ /dev/null @@ -1,8547 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260916082426_AddTaxRatesAndItemTaxRate")] - partial class AddTaxRatesAndItemTaxRate - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260916082426_AddTaxRatesAndItemTaxRate.cs b/Backend/ERPCore/Migrations/20260916082426_AddTaxRatesAndItemTaxRate.cs deleted file mode 100644 index 67e6afe..0000000 --- a/Backend/ERPCore/Migrations/20260916082426_AddTaxRatesAndItemTaxRate.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional - -namespace ERPCore.Migrations -{ - /// - public partial class AddTaxRatesAndItemTaxRate : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "TaxClass", - table: "items"); - - migrationBuilder.AddColumn( - name: "TaxRateId", - table: "items", - type: "integer", - nullable: true); - - migrationBuilder.CreateTable( - name: "tax_rates", - columns: table => new - { - TaxRateId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Code = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - Name = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), - Percentage = table.Column(type: "numeric(5,2)", precision: 5, scale: 2, nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_tax_rates", x => x.TaxRateId); - }); - - migrationBuilder.InsertData( - table: "tax_rates", - columns: new[] { "TaxRateId", "Code", "CreatedAt", "Name", "Percentage", "UpdatedAt" }, - values: new object[,] - { - { 1, "STANDARD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Standard", 15m, null }, - { 2, "ZERO", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Zero-Rated", 0m, null }, - { 3, "EXEMPT", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Exempt", 0m, null } - }); - - migrationBuilder.CreateIndex( - name: "IX_items_TaxRateId", - table: "items", - column: "TaxRateId"); - - migrationBuilder.CreateIndex( - name: "IX_tax_rates_Code", - table: "tax_rates", - column: "Code", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_tax_rates_Status", - table: "tax_rates", - column: "Status"); - - migrationBuilder.AddForeignKey( - name: "FK_items_tax_rates_TaxRateId", - table: "items", - column: "TaxRateId", - principalTable: "tax_rates", - principalColumn: "TaxRateId", - onDelete: ReferentialAction.Restrict); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_items_tax_rates_TaxRateId", - table: "items"); - - migrationBuilder.DropTable( - name: "tax_rates"); - - migrationBuilder.DropIndex( - name: "IX_items_TaxRateId", - table: "items"); - - migrationBuilder.DropColumn( - name: "TaxRateId", - table: "items"); - - migrationBuilder.AddColumn( - name: "TaxClass", - table: "items", - type: "character varying(20)", - maxLength: 20, - nullable: true); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260916102635_BranchIsolationPhase1.Designer.cs b/Backend/ERPCore/Migrations/20260916102635_BranchIsolationPhase1.Designer.cs deleted file mode 100644 index 7436d4d..0000000 --- a/Backend/ERPCore/Migrations/20260916102635_BranchIsolationPhase1.Designer.cs +++ /dev/null @@ -1,8661 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260916102635_BranchIsolationPhase1")] - partial class BranchIsolationPhase1 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260916102635_BranchIsolationPhase1.cs b/Backend/ERPCore/Migrations/20260916102635_BranchIsolationPhase1.cs deleted file mode 100644 index d2f9360..0000000 --- a/Backend/ERPCore/Migrations/20260916102635_BranchIsolationPhase1.cs +++ /dev/null @@ -1,302 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class BranchIsolationPhase1 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_number_sequences_doc_type_year", - table: "number_sequences"); - - migrationBuilder.AddColumn( - name: "BranchId", - table: "vendors", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "BranchId", - table: "rfqs", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "BranchId", - table: "requisitions", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "BranchId", - table: "purchase_orders", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "BranchId", - table: "purchase_invoices", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "branch_id", - table: "number_sequences", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "BranchId", - table: "customers", - type: "integer", - nullable: false, - defaultValue: 0); - - // Backfill: every column just added defaulted existing rows to BranchId/branch_id = 0, - // which satisfies no FK. Point them at the deployment's single default branch - // ("BR-000"/"Main Branch" — same convention BranchConfigService.ResolveDefaultBranchIdAsync - // uses at runtime), creating it here if it doesn't exist yet so this migration is - // self-contained regardless of whether that runtime path has already run. - migrationBuilder.Sql(""" - INSERT INTO hr_branches ("Code", "Name", "Status", "CreatedAt") - SELECT 'BR-000', 'Main Branch', 'Active', now() - WHERE NOT EXISTS (SELECT 1 FROM hr_branches WHERE "Code" = 'BR-000'); - """); - migrationBuilder.Sql(""" - UPDATE vendors SET "BranchId" = (SELECT "BranchId" FROM hr_branches WHERE "Code" = 'BR-000') WHERE "BranchId" = 0; - UPDATE customers SET "BranchId" = (SELECT "BranchId" FROM hr_branches WHERE "Code" = 'BR-000') WHERE "BranchId" = 0; - UPDATE requisitions SET "BranchId" = (SELECT "BranchId" FROM hr_branches WHERE "Code" = 'BR-000') WHERE "BranchId" = 0; - UPDATE rfqs SET "BranchId" = (SELECT "BranchId" FROM hr_branches WHERE "Code" = 'BR-000') WHERE "BranchId" = 0; - UPDATE purchase_orders SET "BranchId" = (SELECT "BranchId" FROM hr_branches WHERE "Code" = 'BR-000') WHERE "BranchId" = 0; - UPDATE purchase_invoices SET "BranchId" = (SELECT "BranchId" FROM hr_branches WHERE "Code" = 'BR-000') WHERE "BranchId" = 0; - UPDATE number_sequences SET branch_id = (SELECT "BranchId" FROM hr_branches WHERE "Code" = 'BR-000') WHERE branch_id = 0; - """); - - migrationBuilder.InsertData( - table: "sub_nav_items", - columns: new[] { "SubNavItemId", "Code", "Href", "Icon", "Label", "NavItemId", "SortOrder" }, - values: new object[] { 43, "products.tax-rates", "/dashboard/products/tax-rates", null, "Tax Rates", 2, 7 }); - - migrationBuilder.InsertData( - table: "permissions", - columns: new[] { "PermissionId", "Code", "NavItemId", "SubNavItemId" }, - values: new object[] { 53, "NAV:products.tax-rates", null, 43 }); - - migrationBuilder.CreateIndex( - name: "IX_vendors_BranchId", - table: "vendors", - column: "BranchId"); - - migrationBuilder.CreateIndex( - name: "IX_rfqs_BranchId", - table: "rfqs", - column: "BranchId"); - - migrationBuilder.CreateIndex( - name: "IX_requisitions_BranchId", - table: "requisitions", - column: "BranchId"); - - migrationBuilder.CreateIndex( - name: "IX_purchase_orders_BranchId", - table: "purchase_orders", - column: "BranchId"); - - migrationBuilder.CreateIndex( - name: "IX_purchase_invoices_BranchId", - table: "purchase_invoices", - column: "BranchId"); - - migrationBuilder.CreateIndex( - name: "IX_number_sequences_branch_id", - table: "number_sequences", - column: "branch_id"); - - migrationBuilder.CreateIndex( - name: "IX_number_sequences_doc_type_branch_id_year", - table: "number_sequences", - columns: new[] { "doc_type", "branch_id", "year" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_customers_BranchId", - table: "customers", - column: "BranchId"); - - migrationBuilder.AddForeignKey( - name: "FK_customers_hr_branches_BranchId", - table: "customers", - column: "BranchId", - principalTable: "hr_branches", - principalColumn: "BranchId", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_number_sequences_hr_branches_branch_id", - table: "number_sequences", - column: "branch_id", - principalTable: "hr_branches", - principalColumn: "BranchId", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_purchase_invoices_hr_branches_BranchId", - table: "purchase_invoices", - column: "BranchId", - principalTable: "hr_branches", - principalColumn: "BranchId", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_purchase_orders_hr_branches_BranchId", - table: "purchase_orders", - column: "BranchId", - principalTable: "hr_branches", - principalColumn: "BranchId", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_requisitions_hr_branches_BranchId", - table: "requisitions", - column: "BranchId", - principalTable: "hr_branches", - principalColumn: "BranchId", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_rfqs_hr_branches_BranchId", - table: "rfqs", - column: "BranchId", - principalTable: "hr_branches", - principalColumn: "BranchId", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_vendors_hr_branches_BranchId", - table: "vendors", - column: "BranchId", - principalTable: "hr_branches", - principalColumn: "BranchId", - onDelete: ReferentialAction.Restrict); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_customers_hr_branches_BranchId", - table: "customers"); - - migrationBuilder.DropForeignKey( - name: "FK_number_sequences_hr_branches_branch_id", - table: "number_sequences"); - - migrationBuilder.DropForeignKey( - name: "FK_purchase_invoices_hr_branches_BranchId", - table: "purchase_invoices"); - - migrationBuilder.DropForeignKey( - name: "FK_purchase_orders_hr_branches_BranchId", - table: "purchase_orders"); - - migrationBuilder.DropForeignKey( - name: "FK_requisitions_hr_branches_BranchId", - table: "requisitions"); - - migrationBuilder.DropForeignKey( - name: "FK_rfqs_hr_branches_BranchId", - table: "rfqs"); - - migrationBuilder.DropForeignKey( - name: "FK_vendors_hr_branches_BranchId", - table: "vendors"); - - migrationBuilder.DropIndex( - name: "IX_vendors_BranchId", - table: "vendors"); - - migrationBuilder.DropIndex( - name: "IX_rfqs_BranchId", - table: "rfqs"); - - migrationBuilder.DropIndex( - name: "IX_requisitions_BranchId", - table: "requisitions"); - - migrationBuilder.DropIndex( - name: "IX_purchase_orders_BranchId", - table: "purchase_orders"); - - migrationBuilder.DropIndex( - name: "IX_purchase_invoices_BranchId", - table: "purchase_invoices"); - - migrationBuilder.DropIndex( - name: "IX_number_sequences_branch_id", - table: "number_sequences"); - - migrationBuilder.DropIndex( - name: "IX_number_sequences_doc_type_branch_id_year", - table: "number_sequences"); - - migrationBuilder.DropIndex( - name: "IX_customers_BranchId", - table: "customers"); - - migrationBuilder.DeleteData( - table: "permissions", - keyColumn: "PermissionId", - keyValue: 53); - - migrationBuilder.DeleteData( - table: "sub_nav_items", - keyColumn: "SubNavItemId", - keyValue: 43); - - migrationBuilder.DropColumn( - name: "BranchId", - table: "vendors"); - - migrationBuilder.DropColumn( - name: "BranchId", - table: "rfqs"); - - migrationBuilder.DropColumn( - name: "BranchId", - table: "requisitions"); - - migrationBuilder.DropColumn( - name: "BranchId", - table: "purchase_orders"); - - migrationBuilder.DropColumn( - name: "BranchId", - table: "purchase_invoices"); - - migrationBuilder.DropColumn( - name: "branch_id", - table: "number_sequences"); - - migrationBuilder.DropColumn( - name: "BranchId", - table: "customers"); - - migrationBuilder.CreateIndex( - name: "IX_number_sequences_doc_type_year", - table: "number_sequences", - columns: new[] { "doc_type", "year" }, - unique: true); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260917052720_AddBarcodeLotScanning.cs b/Backend/ERPCore/Migrations/20260917052720_AddBarcodeLotScanning.cs deleted file mode 100644 index 0c90d77..0000000 --- a/Backend/ERPCore/Migrations/20260917052720_AddBarcodeLotScanning.cs +++ /dev/null @@ -1,205 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddBarcodeLotScanning : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "BatchId", - table: "stock_count_lines", - type: "integer", - nullable: true); - - migrationBuilder.AddColumn( - name: "SerialId", - table: "stock_count_lines", - type: "integer", - nullable: true); - - migrationBuilder.AddColumn( - name: "Barcode", - table: "serials", - type: "character varying(100)", - maxLength: 100, - nullable: true); - - migrationBuilder.AddColumn( - name: "BatchId", - table: "sales_slip_lines", - type: "integer", - nullable: true); - - migrationBuilder.AddColumn( - name: "SerialId", - table: "sales_slip_lines", - type: "integer", - nullable: true); - - migrationBuilder.AddColumn( - name: "Barcode", - table: "items", - type: "character varying(100)", - maxLength: 100, - nullable: true); - - migrationBuilder.AddColumn( - name: "Barcode", - table: "batches", - type: "character varying(100)", - maxLength: 100, - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_stock_count_lines_BatchId", - table: "stock_count_lines", - column: "BatchId"); - - migrationBuilder.CreateIndex( - name: "IX_stock_count_lines_SerialId", - table: "stock_count_lines", - column: "SerialId"); - - migrationBuilder.CreateIndex( - name: "IX_serials_Barcode", - table: "serials", - column: "Barcode", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_sales_slip_lines_BatchId", - table: "sales_slip_lines", - column: "BatchId"); - - migrationBuilder.CreateIndex( - name: "IX_sales_slip_lines_SerialId", - table: "sales_slip_lines", - column: "SerialId"); - - migrationBuilder.CreateIndex( - name: "IX_items_Barcode", - table: "items", - column: "Barcode", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_batches_Barcode", - table: "batches", - column: "Barcode", - unique: true); - - migrationBuilder.AddForeignKey( - name: "FK_sales_slip_lines_batches_BatchId", - table: "sales_slip_lines", - column: "BatchId", - principalTable: "batches", - principalColumn: "BatchId", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_sales_slip_lines_serials_SerialId", - table: "sales_slip_lines", - column: "SerialId", - principalTable: "serials", - principalColumn: "SerialId", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_stock_count_lines_batches_BatchId", - table: "stock_count_lines", - column: "BatchId", - principalTable: "batches", - principalColumn: "BatchId", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_stock_count_lines_serials_SerialId", - table: "stock_count_lines", - column: "SerialId", - principalTable: "serials", - principalColumn: "SerialId", - onDelete: ReferentialAction.Restrict); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_sales_slip_lines_batches_BatchId", - table: "sales_slip_lines"); - - migrationBuilder.DropForeignKey( - name: "FK_sales_slip_lines_serials_SerialId", - table: "sales_slip_lines"); - - migrationBuilder.DropForeignKey( - name: "FK_stock_count_lines_batches_BatchId", - table: "stock_count_lines"); - - migrationBuilder.DropForeignKey( - name: "FK_stock_count_lines_serials_SerialId", - table: "stock_count_lines"); - - migrationBuilder.DropIndex( - name: "IX_stock_count_lines_BatchId", - table: "stock_count_lines"); - - migrationBuilder.DropIndex( - name: "IX_stock_count_lines_SerialId", - table: "stock_count_lines"); - - migrationBuilder.DropIndex( - name: "IX_serials_Barcode", - table: "serials"); - - migrationBuilder.DropIndex( - name: "IX_sales_slip_lines_BatchId", - table: "sales_slip_lines"); - - migrationBuilder.DropIndex( - name: "IX_sales_slip_lines_SerialId", - table: "sales_slip_lines"); - - migrationBuilder.DropIndex( - name: "IX_items_Barcode", - table: "items"); - - migrationBuilder.DropIndex( - name: "IX_batches_Barcode", - table: "batches"); - - migrationBuilder.DropColumn( - name: "BatchId", - table: "stock_count_lines"); - - migrationBuilder.DropColumn( - name: "SerialId", - table: "stock_count_lines"); - - migrationBuilder.DropColumn( - name: "Barcode", - table: "serials"); - - migrationBuilder.DropColumn( - name: "BatchId", - table: "sales_slip_lines"); - - migrationBuilder.DropColumn( - name: "SerialId", - table: "sales_slip_lines"); - - migrationBuilder.DropColumn( - name: "Barcode", - table: "items"); - - migrationBuilder.DropColumn( - name: "Barcode", - table: "batches"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260918182015_changeMismatch.Designer.cs b/Backend/ERPCore/Migrations/20260918182015_changeMismatch.Designer.cs deleted file mode 100644 index 98e2436..0000000 --- a/Backend/ERPCore/Migrations/20260918182015_changeMismatch.Designer.cs +++ /dev/null @@ -1,8231 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260918182015_changeMismatch")] - partial class changeMismatch - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxClass") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("DocType", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Count"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260918182015_changeMismatch.cs b/Backend/ERPCore/Migrations/20260918182015_changeMismatch.cs deleted file mode 100644 index 361cede..0000000 --- a/Backend/ERPCore/Migrations/20260918182015_changeMismatch.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class changeMismatch : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Backend/ERPCore/Migrations/20260929131905_AddSalesConfig.Designer.cs b/Backend/ERPCore/Migrations/20260929131905_AddSalesConfig.Designer.cs deleted file mode 100644 index a4f063f..0000000 --- a/Backend/ERPCore/Migrations/20260929131905_AddSalesConfig.Designer.cs +++ /dev/null @@ -1,8799 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260929131905_AddSalesConfig")] - partial class AddSalesConfig - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowCashCustomer") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("CashCustomerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("CashCustomerId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("sales_config", null, t => - { - t.HasCheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Customer", "CashCustomer") - .WithMany() - .HasForeignKey("CashCustomerId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CashCustomer"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Count"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260929131905_AddSalesConfig.cs b/Backend/ERPCore/Migrations/20260929131905_AddSalesConfig.cs deleted file mode 100644 index bc03c6f..0000000 --- a/Backend/ERPCore/Migrations/20260929131905_AddSalesConfig.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddSalesConfig : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "sales_config", - columns: table => new - { - ConfigId = table.Column(type: "integer", nullable: false), - AllowCashCustomer = table.Column(type: "boolean", nullable: false, defaultValue: false), - CashCustomerId = table.Column(type: "integer", nullable: true), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - UpdatedBy = table.Column(type: "integer", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_sales_config", x => x.ConfigId); - table.CheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - table.ForeignKey( - name: "FK_sales_config_customers_CashCustomerId", - column: x => x.CashCustomerId, - principalTable: "customers", - principalColumn: "CustomerId", - onDelete: ReferentialAction.SetNull); - table.ForeignKey( - name: "FK_sales_config_users_UpdatedBy", - column: x => x.UpdatedBy, - principalTable: "users", - principalColumn: "UserId", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_sales_config_CashCustomerId", - table: "sales_config", - column: "CashCustomerId"); - - migrationBuilder.CreateIndex( - name: "IX_sales_config_UpdatedBy", - table: "sales_config", - column: "UpdatedBy"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "sales_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930043658_AddSalesConfigAllowFreeItems.Designer.cs b/Backend/ERPCore/Migrations/20260930043658_AddSalesConfigAllowFreeItems.Designer.cs deleted file mode 100644 index 406388b..0000000 --- a/Backend/ERPCore/Migrations/20260930043658_AddSalesConfigAllowFreeItems.Designer.cs +++ /dev/null @@ -1,8804 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260930043658_AddSalesConfigAllowFreeItems")] - partial class AddSalesConfigAllowFreeItems - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowCashCustomer") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowFreeItems") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CashCustomerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("CashCustomerId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("sales_config", null, t => - { - t.HasCheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Customer", "CashCustomer") - .WithMany() - .HasForeignKey("CashCustomerId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CashCustomer"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Count"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930043658_AddSalesConfigAllowFreeItems.cs b/Backend/ERPCore/Migrations/20260930043658_AddSalesConfigAllowFreeItems.cs deleted file mode 100644 index c43b73c..0000000 --- a/Backend/ERPCore/Migrations/20260930043658_AddSalesConfigAllowFreeItems.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddSalesConfigAllowFreeItems : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "AllowFreeItems", - table: "sales_config", - type: "boolean", - nullable: false, - defaultValue: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "AllowFreeItems", - table: "sales_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930044903_AddSalesConfigAllowOverStockSale.Designer.cs b/Backend/ERPCore/Migrations/20260930044903_AddSalesConfigAllowOverStockSale.Designer.cs deleted file mode 100644 index 5c14dc3..0000000 --- a/Backend/ERPCore/Migrations/20260930044903_AddSalesConfigAllowOverStockSale.Designer.cs +++ /dev/null @@ -1,8809 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260930044903_AddSalesConfigAllowOverStockSale")] - partial class AddSalesConfigAllowOverStockSale - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowCashCustomer") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowFreeItems") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowOverStockSale") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("CashCustomerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("CashCustomerId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("sales_config", null, t => - { - t.HasCheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Customer", "CashCustomer") - .WithMany() - .HasForeignKey("CashCustomerId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CashCustomer"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Count"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930044903_AddSalesConfigAllowOverStockSale.cs b/Backend/ERPCore/Migrations/20260930044903_AddSalesConfigAllowOverStockSale.cs deleted file mode 100644 index e8ee109..0000000 --- a/Backend/ERPCore/Migrations/20260930044903_AddSalesConfigAllowOverStockSale.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddSalesConfigAllowOverStockSale : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "AllowOverStockSale", - table: "sales_config", - type: "boolean", - nullable: false, - defaultValue: false); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "AllowOverStockSale", - table: "sales_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930050220_AddSalesConfigWarehouseSelection.Designer.cs b/Backend/ERPCore/Migrations/20260930050220_AddSalesConfigWarehouseSelection.Designer.cs deleted file mode 100644 index 6caa4a2..0000000 --- a/Backend/ERPCore/Migrations/20260930050220_AddSalesConfigWarehouseSelection.Designer.cs +++ /dev/null @@ -1,8826 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260930050220_AddSalesConfigWarehouseSelection")] - partial class AddSalesConfigWarehouseSelection - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowCashCustomer") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowFreeItems") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowOverStockSale") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowWarehouseSelection") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CashCustomerId") - .HasColumnType("integer"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("CashCustomerId"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("sales_config", null, t => - { - t.HasCheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Customer", "CashCustomer") - .WithMany() - .HasForeignKey("CashCustomerId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CashCustomer"); - - b.Navigation("DefaultWarehouse"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Count"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930050220_AddSalesConfigWarehouseSelection.cs b/Backend/ERPCore/Migrations/20260930050220_AddSalesConfigWarehouseSelection.cs deleted file mode 100644 index 680f6dc..0000000 --- a/Backend/ERPCore/Migrations/20260930050220_AddSalesConfigWarehouseSelection.cs +++ /dev/null @@ -1,60 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddSalesConfigWarehouseSelection : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "AllowWarehouseSelection", - table: "sales_config", - type: "boolean", - nullable: false, - defaultValue: true); - - migrationBuilder.AddColumn( - name: "DefaultWarehouseId", - table: "sales_config", - type: "integer", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_sales_config_DefaultWarehouseId", - table: "sales_config", - column: "DefaultWarehouseId"); - - migrationBuilder.AddForeignKey( - name: "FK_sales_config_warehouses_DefaultWarehouseId", - table: "sales_config", - column: "DefaultWarehouseId", - principalTable: "warehouses", - principalColumn: "WarehouseId", - onDelete: ReferentialAction.SetNull); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_sales_config_warehouses_DefaultWarehouseId", - table: "sales_config"); - - migrationBuilder.DropIndex( - name: "IX_sales_config_DefaultWarehouseId", - table: "sales_config"); - - migrationBuilder.DropColumn( - name: "AllowWarehouseSelection", - table: "sales_config"); - - migrationBuilder.DropColumn( - name: "DefaultWarehouseId", - table: "sales_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930062500_AddProductConfigCustomVariants.cs b/Backend/ERPCore/Migrations/20260930062500_AddProductConfigCustomVariants.cs deleted file mode 100644 index 69225e0..0000000 --- a/Backend/ERPCore/Migrations/20260930062500_AddProductConfigCustomVariants.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddProductConfigCustomVariants : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "CustomVariantsEnabled", - table: "product_config", - type: "boolean", - nullable: false, - defaultValue: false); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "CustomVariantsEnabled", - table: "product_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930063644_AddItemImages.Designer.cs b/Backend/ERPCore/Migrations/20260930063644_AddItemImages.Designer.cs deleted file mode 100644 index 4fa77e2..0000000 --- a/Backend/ERPCore/Migrations/20260930063644_AddItemImages.Designer.cs +++ /dev/null @@ -1,8897 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260930063644_AddItemImages")] - partial class AddItemImages - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.Property("ItemImageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemImageId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("ItemImageId"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("item_images", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CustomVariantsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemImagesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowCashCustomer") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowFreeItems") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowOverStockSale") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowWarehouseSelection") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CashCustomerId") - .HasColumnType("integer"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("CashCustomerId"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("sales_config", null, t => - { - t.HasCheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Customer", "CashCustomer") - .WithMany() - .HasForeignKey("CashCustomerId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CashCustomer"); - - b.Navigation("DefaultWarehouse"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Count"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930063644_AddItemImages.cs b/Backend/ERPCore/Migrations/20260930063644_AddItemImages.cs deleted file mode 100644 index 48b0259..0000000 --- a/Backend/ERPCore/Migrations/20260930063644_AddItemImages.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddItemImages : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "ItemImagesEnabled", - table: "product_config", - type: "boolean", - nullable: false, - defaultValue: false); - - migrationBuilder.CreateTable( - name: "item_images", - columns: table => new - { - ItemImageId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ItemId = table.Column(type: "integer", nullable: false), - OriginalFileName = table.Column(type: "character varying(260)", maxLength: 260, nullable: false), - StoredFileName = table.Column(type: "character varying(260)", maxLength: 260, nullable: false), - RelativePath = table.Column(type: "character varying(500)", maxLength: 500, nullable: false), - ContentType = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - SizeBytes = table.Column(type: "bigint", nullable: false), - SortOrder = table.Column(type: "integer", nullable: false), - UploadedBy = table.Column(type: "integer", nullable: false), - UploadedAt = table.Column(type: "timestamp with time zone", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_item_images", x => x.ItemImageId); - table.ForeignKey( - name: "FK_item_images_items_ItemId", - column: x => x.ItemId, - principalTable: "items", - principalColumn: "ItemId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_item_images_ItemId_SortOrder", - table: "item_images", - columns: new[] { "ItemId", "SortOrder" }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "item_images"); - - migrationBuilder.DropColumn( - name: "ItemImagesEnabled", - table: "product_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930065738_AddCustomWarrantyPeriods.Designer.cs b/Backend/ERPCore/Migrations/20260930065738_AddCustomWarrantyPeriods.Designer.cs deleted file mode 100644 index 2c4d679..0000000 --- a/Backend/ERPCore/Migrations/20260930065738_AddCustomWarrantyPeriods.Designer.cs +++ /dev/null @@ -1,8909 +0,0 @@ -// -using System; -using System.Collections.Generic; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260930065738_AddCustomWarrantyPeriods")] - partial class AddCustomWarrantyPeriods - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.Property("ItemImageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemImageId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("ItemImageId"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("item_images", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CustomVariantsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.PrimitiveCollection>("CustomWarrantyPeriodMonths") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("integer[]") - .HasDefaultValueSql("'{}'::integer[]"); - - b.Property("CustomWarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemImagesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowCashCustomer") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowFreeItems") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowOverStockSale") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowWarehouseSelection") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CashCustomerId") - .HasColumnType("integer"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("CashCustomerId"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("sales_config", null, t => - { - t.HasCheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Customer", "CashCustomer") - .WithMany() - .HasForeignKey("CashCustomerId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CashCustomer"); - - b.Navigation("DefaultWarehouse"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Count"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930065738_AddCustomWarrantyPeriods.cs b/Backend/ERPCore/Migrations/20260930065738_AddCustomWarrantyPeriods.cs deleted file mode 100644 index eea1553..0000000 --- a/Backend/ERPCore/Migrations/20260930065738_AddCustomWarrantyPeriods.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Collections.Generic; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddCustomWarrantyPeriods : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn>( - name: "CustomWarrantyPeriodMonths", - table: "product_config", - type: "integer[]", - nullable: false, - defaultValueSql: "'{}'::integer[]"); - - migrationBuilder.AddColumn( - name: "CustomWarrantyPeriodsEnabled", - table: "product_config", - type: "boolean", - nullable: false, - defaultValue: false); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "CustomWarrantyPeriodMonths", - table: "product_config"); - - migrationBuilder.DropColumn( - name: "CustomWarrantyPeriodsEnabled", - table: "product_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930071621_MoveCustomWarrantyPeriodsToMaster.Designer.cs b/Backend/ERPCore/Migrations/20260930071621_MoveCustomWarrantyPeriodsToMaster.Designer.cs deleted file mode 100644 index a72a6f2..0000000 --- a/Backend/ERPCore/Migrations/20260930071621_MoveCustomWarrantyPeriodsToMaster.Designer.cs +++ /dev/null @@ -1,8939 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260930071621_MoveCustomWarrantyPeriodsToMaster")] - partial class MoveCustomWarrantyPeriodsToMaster - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.Property("ItemImageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemImageId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("ItemImageId"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("item_images", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CustomVariantsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("CustomWarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemImagesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowCashCustomer") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowFreeItems") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowOverStockSale") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowWarehouseSelection") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CashCustomerId") - .HasColumnType("integer"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("CashCustomerId"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("sales_config", null, t => - { - t.HasCheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WarrantyPeriod", b => - { - b.Property("WarrantyPeriodId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarrantyPeriodId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Months") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("WarrantyPeriodId"); - - b.HasIndex("Months") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("warranty_periods", null, t => - { - t.HasCheckConstraint("ck_warranty_periods_months", "\"Months\" BETWEEN 1 AND 600"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Customer", "CashCustomer") - .WithMany() - .HasForeignKey("CashCustomerId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CashCustomer"); - - b.Navigation("DefaultWarehouse"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Count"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930071621_MoveCustomWarrantyPeriodsToMaster.cs b/Backend/ERPCore/Migrations/20260930071621_MoveCustomWarrantyPeriodsToMaster.cs deleted file mode 100644 index 912e706..0000000 --- a/Backend/ERPCore/Migrations/20260930071621_MoveCustomWarrantyPeriodsToMaster.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class MoveCustomWarrantyPeriodsToMaster : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "warranty_periods", - columns: table => new - { - WarrantyPeriodId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Months = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_warranty_periods", x => x.WarrantyPeriodId); - table.CheckConstraint("ck_warranty_periods_months", "\"Months\" BETWEEN 1 AND 600"); - }); - - migrationBuilder.CreateIndex( - name: "IX_warranty_periods_Months", - table: "warranty_periods", - column: "Months", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_warranty_periods_Status", - table: "warranty_periods", - column: "Status"); - - // Carry over any periods already saved on the config (hand-added — EF would have - // dropped the column first and lost them). Out-of-range values are skipped rather - // than failing the check constraint. - migrationBuilder.Sql(""" - INSERT INTO warranty_periods ("Months", "Status", "CreatedAt") - SELECT DISTINCT m, 'Active', now() - FROM product_config, unnest("CustomWarrantyPeriodMonths") AS m - WHERE m BETWEEN 1 AND 600 - ON CONFLICT ("Months") DO NOTHING; - """); - - migrationBuilder.DropColumn( - name: "CustomWarrantyPeriodMonths", - table: "product_config"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn>( - name: "CustomWarrantyPeriodMonths", - table: "product_config", - type: "integer[]", - nullable: false, - defaultValueSql: "'{}'::integer[]"); - - migrationBuilder.Sql(""" - UPDATE product_config SET "CustomWarrantyPeriodMonths" = COALESCE( - (SELECT array_agg("Months" ORDER BY "Months") FROM warranty_periods WHERE "Status" = 'Active'), - '{}'::integer[]); - """); - - migrationBuilder.DropTable( - name: "warranty_periods"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930094023_AddSalesConfigAllowDiscounts.Designer.cs b/Backend/ERPCore/Migrations/20260930094023_AddSalesConfigAllowDiscounts.Designer.cs deleted file mode 100644 index e5ea9fe..0000000 --- a/Backend/ERPCore/Migrations/20260930094023_AddSalesConfigAllowDiscounts.Designer.cs +++ /dev/null @@ -1,8944 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260930094023_AddSalesConfigAllowDiscounts")] - partial class AddSalesConfigAllowDiscounts - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.Property("ItemImageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemImageId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("ItemImageId"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("item_images", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CustomVariantsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("CustomWarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemImagesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowCashCustomer") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowDiscounts") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowFreeItems") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowOverStockSale") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowWarehouseSelection") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CashCustomerId") - .HasColumnType("integer"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("CashCustomerId"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("sales_config", null, t => - { - t.HasCheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WarrantyPeriod", b => - { - b.Property("WarrantyPeriodId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarrantyPeriodId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Months") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("WarrantyPeriodId"); - - b.HasIndex("Months") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("warranty_periods", null, t => - { - t.HasCheckConstraint("ck_warranty_periods_months", "\"Months\" BETWEEN 1 AND 600"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Customer", "CashCustomer") - .WithMany() - .HasForeignKey("CashCustomerId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CashCustomer"); - - b.Navigation("DefaultWarehouse"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Count"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930094023_AddSalesConfigAllowDiscounts.cs b/Backend/ERPCore/Migrations/20260930094023_AddSalesConfigAllowDiscounts.cs deleted file mode 100644 index 474f4de..0000000 --- a/Backend/ERPCore/Migrations/20260930094023_AddSalesConfigAllowDiscounts.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddSalesConfigAllowDiscounts : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "AllowDiscounts", - table: "sales_config", - type: "boolean", - nullable: false, - defaultValue: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "AllowDiscounts", - table: "sales_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20261002061913_AddGrnConfig.Designer.cs b/Backend/ERPCore/Migrations/20261002061913_AddGrnConfig.Designer.cs deleted file mode 100644 index 5257e4e..0000000 --- a/Backend/ERPCore/Migrations/20261002061913_AddGrnConfig.Designer.cs +++ /dev/null @@ -1,8998 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20261002061913_AddGrnConfig")] - partial class AddGrnConfig - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowWarehouseSelection") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("grn_config", null, t => - { - t.HasCheckConstraint("ck_grn_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.Property("ItemImageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemImageId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("ItemImageId"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("item_images", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CustomVariantsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("CustomWarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemImagesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowCashCustomer") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowDiscounts") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowFreeItems") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowOverStockSale") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowWarehouseSelection") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CashCustomerId") - .HasColumnType("integer"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("CashCustomerId"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("sales_config", null, t => - { - t.HasCheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WarrantyPeriod", b => - { - b.Property("WarrantyPeriodId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarrantyPeriodId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Months") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("WarrantyPeriodId"); - - b.HasIndex("Months") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("warranty_periods", null, t => - { - t.HasCheckConstraint("ck_warranty_periods_months", "\"Months\" BETWEEN 1 AND 600"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("DefaultWarehouse"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Customer", "CashCustomer") - .WithMany() - .HasForeignKey("CashCustomerId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CashCustomer"); - - b.Navigation("DefaultWarehouse"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Count"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20261002061913_AddGrnConfig.cs b/Backend/ERPCore/Migrations/20261002061913_AddGrnConfig.cs deleted file mode 100644 index 695addd..0000000 --- a/Backend/ERPCore/Migrations/20261002061913_AddGrnConfig.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddGrnConfig : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "grn_config", - columns: table => new - { - ConfigId = table.Column(type: "integer", nullable: false), - AllowWarehouseSelection = table.Column(type: "boolean", nullable: false, defaultValue: true), - DefaultWarehouseId = table.Column(type: "integer", nullable: true), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - UpdatedBy = table.Column(type: "integer", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_grn_config", x => x.ConfigId); - table.CheckConstraint("ck_grn_config_singleton", "\"ConfigId\" = 1"); - table.ForeignKey( - name: "FK_grn_config_users_UpdatedBy", - column: x => x.UpdatedBy, - principalTable: "users", - principalColumn: "UserId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_grn_config_warehouses_DefaultWarehouseId", - column: x => x.DefaultWarehouseId, - principalTable: "warehouses", - principalColumn: "WarehouseId", - onDelete: ReferentialAction.SetNull); - }); - - migrationBuilder.CreateIndex( - name: "IX_grn_config_DefaultWarehouseId", - table: "grn_config", - column: "DefaultWarehouseId"); - - migrationBuilder.CreateIndex( - name: "IX_grn_config_UpdatedBy", - table: "grn_config", - column: "UpdatedBy"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "grn_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20261002064142_AddGrnConfigDiscountsVat.Designer.cs b/Backend/ERPCore/Migrations/20261002064142_AddGrnConfigDiscountsVat.Designer.cs deleted file mode 100644 index 1fa8ae5..0000000 --- a/Backend/ERPCore/Migrations/20261002064142_AddGrnConfigDiscountsVat.Designer.cs +++ /dev/null @@ -1,9008 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20261002064142_AddGrnConfigDiscountsVat")] - partial class AddGrnConfigDiscountsVat - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowDiscounts") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowVat") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowWarehouseSelection") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("grn_config", null, t => - { - t.HasCheckConstraint("ck_grn_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.Property("ItemImageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemImageId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("ItemImageId"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("item_images", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CustomVariantsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("CustomWarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemImagesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowCashCustomer") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowDiscounts") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowFreeItems") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowOverStockSale") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowWarehouseSelection") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CashCustomerId") - .HasColumnType("integer"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("CashCustomerId"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("sales_config", null, t => - { - t.HasCheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WarrantyPeriod", b => - { - b.Property("WarrantyPeriodId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarrantyPeriodId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Months") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("WarrantyPeriodId"); - - b.HasIndex("Months") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("warranty_periods", null, t => - { - t.HasCheckConstraint("ck_warranty_periods_months", "\"Months\" BETWEEN 1 AND 600"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("DefaultWarehouse"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Customer", "CashCustomer") - .WithMany() - .HasForeignKey("CashCustomerId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CashCustomer"); - - b.Navigation("DefaultWarehouse"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Count"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20261002064142_AddGrnConfigDiscountsVat.cs b/Backend/ERPCore/Migrations/20261002064142_AddGrnConfigDiscountsVat.cs deleted file mode 100644 index eab0393..0000000 --- a/Backend/ERPCore/Migrations/20261002064142_AddGrnConfigDiscountsVat.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddGrnConfigDiscountsVat : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "AllowDiscounts", - table: "grn_config", - type: "boolean", - nullable: false, - defaultValue: true); - - migrationBuilder.AddColumn( - name: "AllowVat", - table: "grn_config", - type: "boolean", - nullable: false, - defaultValue: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "AllowDiscounts", - table: "grn_config"); - - migrationBuilder.DropColumn( - name: "AllowVat", - table: "grn_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260917052720_AddBarcodeLotScanning.Designer.cs b/Backend/ERPCore/Migrations/20261005031409_Baseline_MySql.Designer.cs similarity index 76% rename from Backend/ERPCore/Migrations/20260917052720_AddBarcodeLotScanning.Designer.cs rename to Backend/ERPCore/Migrations/20261005031409_Baseline_MySql.Designer.cs index 6fb946a..9bcc6ac 100644 --- a/Backend/ERPCore/Migrations/20260917052720_AddBarcodeLotScanning.Designer.cs +++ b/Backend/ERPCore/Migrations/20261005031409_Baseline_MySql.Designer.cs @@ -3,97 +3,96 @@ using System; using ERPCore.Infra.Persistence; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace ERPCore.Migrations { [DbContext(typeof(ErpDbContext))] - [Migration("20260917052720_AddBarcodeLotScanning")] - partial class AddBarcodeLotScanning + [Migration("20261005031409_Baseline_MySql")] + partial class Baseline_MySql { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); + .UseCollation("utf8mb4_unicode_ci") + .HasAnnotation("ProductVersion", "9.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 64); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => { b.Property("AttendanceRecordId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("AttendanceRecordId")); b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("AttendanceStatus") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CheckIn") - .HasColumnType("interval"); + .HasColumnType("time(6)"); b.Property("CheckOut") - .HasColumnType("interval"); + .HasColumnType("time(6)"); b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EditedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("IsManualOverride") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("LateMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Notes") .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); + .HasColumnType("varchar(1000)"); b.Property("OvertimeMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowValidationStatus") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("WorkShiftId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WorkingMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("AttendanceRecordId"); @@ -110,61 +109,59 @@ namespace ERPCore.Migrations { b.Property("AttendanceUploadBatchId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("AttendanceUploadBatchId")); b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ConfirmedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("OriginalFileName") .HasMaxLength(260) - .HasColumnType("character varying(260)"); + .HasColumnType("varchar(260)"); b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("RowCountDuplicate") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowCountError") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowCountTotal") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SourceType") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UploadedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("AttendanceUploadBatchId"); @@ -182,32 +179,32 @@ namespace ERPCore.Migrations { b.Property("AuditId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("AuditId")); b.Property("Action") .IsRequired() .HasMaxLength(10) - .HasColumnType("character varying(10)"); + .HasColumnType("varchar(10)"); b.Property("ChangeSet") .IsRequired() - .HasColumnType("jsonb"); + .HasColumnType("longtext"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EntityId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EntityType") .IsRequired() .HasMaxLength(80) - .HasColumnType("character varying(80)"); + .HasColumnType("varchar(80)"); b.Property("UserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("AuditId"); @@ -224,24 +221,24 @@ namespace ERPCore.Migrations { b.Property("BatchId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BatchId")); b.Property("Barcode") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("BatchNo") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("ExpiryDate") .HasColumnType("date"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("BatchId"); @@ -258,21 +255,21 @@ namespace ERPCore.Migrations { b.Property("BinId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BinId")); b.Property("BinType") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Code") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("BinId"); @@ -286,46 +283,44 @@ namespace ERPCore.Migrations { b.Property("BranchId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BranchId")); b.Property("Address") .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("PhoneNumber") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("BranchId"); @@ -340,27 +335,25 @@ namespace ERPCore.Migrations modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => { b.Property("ConfigId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BranchingEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UpdatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.HasKey("ConfigId"); @@ -368,7 +361,7 @@ namespace ERPCore.Migrations b.ToTable("branch_config", null, t => { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); + t.HasCheckConstraint("ck_branch_config_singleton", "`ConfigId` = 1"); }); }); @@ -376,33 +369,31 @@ namespace ERPCore.Migrations { b.Property("BrandId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BrandId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("BrandId"); @@ -418,90 +409,88 @@ namespace ERPCore.Migrations { b.Property("BundleSaleId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BundleSaleId")); b.Property("BundleCode") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("BundleName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("BundleNo") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("BundlePrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CashierUserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ComponentSubtotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); + .HasColumnType("decimal(18,4)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CustomerId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CustomerSnapshotName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("DayEndId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DiscountTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("GrandTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("MarginAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Draft"); b.Property("TaxTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("BundleSaleId"); @@ -525,48 +514,48 @@ namespace ERPCore.Migrations { b.Property("BundleSaleLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BundleSaleLineId")); b.Property("BundleSaleId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Description") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("IncludeInBundle") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("IsComponent") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LineTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ParentLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("UnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("BundleSaleLineId"); @@ -583,42 +572,40 @@ namespace ERPCore.Migrations { b.Property("BundleSaleTemplateId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BundleSaleTemplateId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Description") .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); + .HasColumnType("varchar(1000)"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("TemplateCode") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("TemplateName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("BundleSaleTemplateId"); @@ -632,34 +619,34 @@ namespace ERPCore.Migrations { b.Property("BundleSaleTemplateLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BundleSaleTemplateLineId")); b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("IncludeInBundle") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("SortOrder") .ValueGeneratedOnAdd() - .HasColumnType("integer") + .HasColumnType("int") .HasDefaultValue(0); b.Property("UnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("BundleSaleTemplateLineId"); @@ -676,33 +663,31 @@ namespace ERPCore.Migrations { b.Property("CategoryId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CategoryId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("CategoryId"); @@ -718,90 +703,88 @@ namespace ERPCore.Migrations { b.Property("CustomerId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CustomerId")); b.Property("AddressLine1") .HasMaxLength(250) - .HasColumnType("character varying(250)"); + .HasColumnType("varchar(250)"); b.Property("AddressLine2") .HasMaxLength(250) - .HasColumnType("character varying(250)"); + .HasColumnType("varchar(250)"); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("City") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("Country") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreditDays") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreditLimit") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("CustomerCode") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("CustomerType") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("B2C"); b.Property("DefaultWarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DisplayName") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("Email") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("Phone") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("TaxRegistrationNo") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("CustomerId"); @@ -823,47 +806,45 @@ namespace ERPCore.Migrations { b.Property("DepartmentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("DepartmentId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("HeadEmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("ParentDepartmentId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("DepartmentId"); @@ -885,38 +866,36 @@ namespace ERPCore.Migrations { b.Property("DesignationId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("DesignationId")); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("DesignationId"); @@ -932,145 +911,143 @@ namespace ERPCore.Migrations { b.Property("EmployeeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EmployeeId")); b.Property("AddressLine1") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("AddressLine2") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("City") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Country") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("DepartmentId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DesignationId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Email") .HasMaxLength(320) - .HasColumnType("character varying(320)"); + .HasColumnType("varchar(320)"); b.Property("EmergencyContactName") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("EmergencyContactPhone") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("EmergencyContactRelationship") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("EmployeeCode") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("EmploymentTypeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EpfNumber") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("EtfNumber") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("FullName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("Gender") .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("HireDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Nationality") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("Nic") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("PersonalMobile") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("PostalCode") .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("ProfilePhotoPath") .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("ReportingManagerId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("TaxIdentificationNumber") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UpdatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("UserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WorkShiftId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("EmployeeId"); @@ -1103,58 +1080,56 @@ namespace ERPCore.Migrations { b.Property("EmployeeBankDetailId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EmployeeBankDetailId")); b.Property("AccountHolderName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("AccountNumber") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("BankName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("BranchName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("IsPrimary") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("SwiftCode") .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("EmployeeBankDetailId"); @@ -1167,46 +1142,44 @@ namespace ERPCore.Migrations { b.Property("EmployeeDocumentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EmployeeDocumentId")); b.Property("ContentType") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("HrDocumentTypeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Notes") .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); + .HasColumnType("varchar(1000)"); b.Property("OriginalFileName") .IsRequired() .HasMaxLength(260) - .HasColumnType("character varying(260)"); + .HasColumnType("varchar(260)"); b.Property("RelativePath") .IsRequired() .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SizeBytes") .HasColumnType("bigint"); @@ -1215,25 +1188,25 @@ namespace ERPCore.Migrations .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("StoredFileName") .IsRequired() .HasMaxLength(260) - .HasColumnType("character varying(260)"); + .HasColumnType("varchar(260)"); b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UploadedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("VerifiedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("EmployeeDocumentId"); @@ -1250,70 +1223,68 @@ namespace ERPCore.Migrations { b.Property("EmployeeLoanId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EmployeeLoanId")); b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ApprovedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("InstallmentAmount") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("InterestRate") .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); + .HasColumnType("decimal(6,4)"); b.Property("LoanKind") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("NumberOfInstallments") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("OutstandingBalance") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("PrincipalAmount") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("StartMonth") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("StartYear") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("EmployeeLoanId"); @@ -1331,50 +1302,48 @@ namespace ERPCore.Migrations { b.Property("EmployeeSalaryStructureId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EmployeeSalaryStructureId")); b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ApprovedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BasicSalary") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Currency") .IsRequired() .HasMaxLength(3) - .HasColumnType("character varying(3)"); + .HasColumnType("varchar(3)"); b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("EmployeeSalaryStructureId"); @@ -1387,19 +1356,19 @@ namespace ERPCore.Migrations { b.Property("EmployeeSalaryStructureLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EmployeeSalaryStructureLineId")); b.Property("Amount") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SalaryComponentId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("EmployeeSalaryStructureLineId"); @@ -1414,38 +1383,36 @@ namespace ERPCore.Migrations { b.Property("EmploymentTypeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EmploymentTypeId")); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("EmploymentTypeId"); @@ -1461,56 +1428,54 @@ namespace ERPCore.Migrations { b.Property("GrnId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("GrnId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("PoId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("VendorId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("GrnId"); @@ -1538,65 +1503,65 @@ namespace ERPCore.Migrations { b.Property("GrnLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("GrnLineId")); b.Property("BatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BinId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DiscountPct") .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); + .HasColumnType("decimal(9,4)"); b.Property("GrnId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("HoldStatus") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LineTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("NetUnitCost") .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); + .HasColumnType("decimal(18,6)"); b.Property("PoLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PoUnitPrice") .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); + .HasColumnType("decimal(18,6)"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ReceivedValue") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("UnitCost") .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); + .HasColumnType("decimal(18,6)"); b.Property("VatAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("VatPct") .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); + .HasColumnType("decimal(9,4)"); b.HasKey("GrnLineId"); @@ -1617,20 +1582,20 @@ namespace ERPCore.Migrations { b.Property("GrnLineWarrantyNumberId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("GrnLineWarrantyNumberId")); b.Property("GrnLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WarrantyNo") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("GrnLineWarrantyNumberId"); @@ -1644,49 +1609,47 @@ namespace ERPCore.Migrations { b.Property("HrDocumentTypeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("HrDocumentTypeId")); b.Property("Category") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ExpiryTracked") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("HrDocumentTypeId"); @@ -1702,112 +1665,110 @@ namespace ERPCore.Migrations { b.Property("ItemId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ItemId")); b.Property("Barcode") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("BaseUomId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BrandId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CategoryId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ContentBaseQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ContentBaseUnit") .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("ContentQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ContentUnit") .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("DefaultVendorId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Description") .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); + .HasColumnType("varchar(1000)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SellingFlatPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("SellingMaxPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("SellingMinPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("Sku") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("StockNature") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("SubCategoryId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("TaxRateId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("TrackingMode") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Warranty") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("NonWarranty"); b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ItemId"); @@ -1838,23 +1799,23 @@ namespace ERPCore.Migrations { b.Property("ReorderId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ReorderId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ReorderPoint") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ReorderQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ReorderId"); @@ -1870,38 +1831,36 @@ namespace ERPCore.Migrations { b.Property("ItemTypeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ItemTypeId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("IsMeasurable") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("ItemTypeId"); @@ -1917,31 +1876,31 @@ namespace ERPCore.Migrations { b.Property("JournalId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JournalId")); b.Property("Amount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("CreditAccount") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("DebitAccount") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("SourceDocId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SourceDocType") .IsRequired() .HasMaxLength(10) - .HasColumnType("character varying(10)"); + .HasColumnType("varchar(10)"); b.HasKey("JournalId"); @@ -1954,43 +1913,41 @@ namespace ERPCore.Migrations { b.Property("LeaveBalanceId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("LeaveBalanceId")); b.Property("AdjustmentDays") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("CarriedForwardDays") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EntitledDays") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("LeaveTypeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("TakenDays") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Year") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("LeaveBalanceId"); @@ -2006,61 +1963,59 @@ namespace ERPCore.Migrations { b.Property("LeaveRequestId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("LeaveRequestId")); b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ApprovedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DaysCount") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EndDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("LeaveTypeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Reason") .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); + .HasColumnType("varchar(1000)"); b.Property("RejectionReason") .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); + .HasColumnType("varchar(1000)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("StartDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("LeaveRequestId"); @@ -2082,57 +2037,55 @@ namespace ERPCore.Migrations { b.Property("LeaveTypeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("LeaveTypeId")); b.Property("AccrualPerYear") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CountsAsNoPay") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("IsPaid") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RequiresApproval") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("LeaveTypeId"); @@ -2148,43 +2101,41 @@ namespace ERPCore.Migrations { b.Property("LoanInstallmentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("LoanInstallmentId")); b.Property("DueMonth") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DueYear") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EmployeeLoanId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("InstallmentNumber") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PaidAmount") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("PayrollRunId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("ScheduledAmount") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("LoanInstallmentId"); @@ -2201,27 +2152,27 @@ namespace ERPCore.Migrations { b.Property("LoginActivityId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("LoginActivityId")); b.Property("DeviceLabel") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("IpAddress") .HasMaxLength(64) - .HasColumnType("character varying(64)"); + .HasColumnType("varchar(64)"); b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UserAgent") .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("UserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("LoginActivityId"); @@ -2234,36 +2185,36 @@ namespace ERPCore.Migrations { b.Property("NavItemId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("NavItemId")); b.Property("Code") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Href") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("Icon") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Label") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("SortOrder") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.HasKey("NavItemId"); @@ -2397,34 +2348,34 @@ namespace ERPCore.Migrations { b.Property("NotificationId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("NotificationId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Message") .IsRequired() .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); + .HasColumnType("varchar(1000)"); b.Property("ModuleKey") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("RelatedEntityId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RelatedEntityType") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("Title") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.HasKey("NotificationId"); @@ -2436,19 +2387,17 @@ namespace ERPCore.Migrations modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => { b.Property("NotificationConfigId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UpdatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("NotificationConfigId"); @@ -2456,7 +2405,7 @@ namespace ERPCore.Migrations b.ToTable("notification_config", null, t => { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); + t.HasCheckConstraint("ck_notification_config_singleton", "`NotificationConfigId` = 1"); }); }); @@ -2464,31 +2413,31 @@ namespace ERPCore.Migrations { b.Property("NotificationConfigModuleId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("NotificationConfigModuleId")); b.Property("EmailEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.Property("InAppEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.Property("ModuleKey") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("NotificationConfigId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SmsEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.HasKey("NotificationConfigModuleId"); @@ -2505,21 +2454,21 @@ namespace ERPCore.Migrations { b.Property("NotificationRecipientId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("NotificationRecipientId")); b.Property("IsRead") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("NotificationId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("NotificationRecipientId"); @@ -2534,26 +2483,26 @@ namespace ERPCore.Migrations { b.Property("SequenceId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SequenceId")); b.Property("BranchId") - .HasColumnType("integer") + .HasColumnType("int") .HasColumnName("branch_id"); b.Property("DocType") .IsRequired() .HasMaxLength(10) - .HasColumnType("character varying(10)") + .HasColumnType("varchar(10)") .HasColumnName("doc_type"); b.Property("LastNumber") - .HasColumnType("integer") + .HasColumnType("int") .HasColumnName("last_number"); b.Property("Year") - .HasColumnType("integer") + .HasColumnType("int") .HasColumnName("year"); b.HasKey("SequenceId"); @@ -2570,78 +2519,89 @@ namespace ERPCore.Migrations { b.Property("PayrollLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PayrollLineId")); b.Property("AbsentDays") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("LateMinutesTotal") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LeaveDays") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("OtMinutesTotal") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("PayrollRunId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PresentDays") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("WorkingDays") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("PayrollLineId"); @@ -2657,32 +2617,32 @@ namespace ERPCore.Migrations { b.Property("PayrollLineComponentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PayrollLineComponentId")); b.Property("Amount") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("ComponentCategory") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Label") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("PayrollLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SalaryComponentId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SortOrder") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("PayrollLineComponentId"); @@ -2697,62 +2657,60 @@ namespace ERPCore.Migrations { b.Property("PayrollRunId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PayrollRunId")); b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ApprovedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("GeneratedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("LockedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PeriodMonth") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PeriodYear") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("UnlockReason") .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UnlockedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("PayrollRunId"); @@ -2772,43 +2730,41 @@ namespace ERPCore.Migrations { b.Property("PayrollStatutorySettingId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PayrollStatutorySettingId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EpfEmployeeRate") .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); + .HasColumnType("decimal(6,4)"); b.Property("EpfEmployerRate") .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); + .HasColumnType("decimal(6,4)"); b.Property("EtfEmployerRate") .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); + .HasColumnType("decimal(6,4)"); b.Property("OtMultiplierDefault") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.HasKey("PayrollStatutorySettingId"); @@ -2821,21 +2777,21 @@ namespace ERPCore.Migrations { b.Property("PayslipId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PayslipId")); b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("PayrollLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ReleasedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("PayslipId"); @@ -2849,20 +2805,20 @@ namespace ERPCore.Migrations { b.Property("PermissionId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PermissionId")); b.Property("Code") .IsRequired() .HasMaxLength(80) - .HasColumnType("character varying(80)"); + .HasColumnType("varchar(80)"); b.Property("NavItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SubNavItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("PermissionId"); @@ -3200,34 +3156,34 @@ namespace ERPCore.Migrations { b.Property("PoLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PoLineId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PoId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("QtyReceived") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("Tax") .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); + .HasColumnType("decimal(9,4)"); b.Property("UnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("PoLineId"); @@ -3243,53 +3199,51 @@ namespace ERPCore.Migrations modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => { b.Property("ConfigId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BatchListsEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("BrandsEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("ItemTypesEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SellingPricesEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("SerialNumbersEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("SubcategoriesEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UpdatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WarrantyPeriodsEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.HasKey("ConfigId"); @@ -3298,7 +3252,7 @@ namespace ERPCore.Migrations b.ToTable("product_config", null, t => { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); + t.HasCheckConstraint("ck_product_config_singleton", "`ConfigId` = 1"); }); }); @@ -3306,57 +3260,55 @@ namespace ERPCore.Migrations { b.Property("RunId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RunId")); b.Property("CancelReasonCodeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("OutputBinId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ReworkCount") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("ScaleFactor") .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); + .HasColumnType("decimal(18,6)"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("TargetQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("TemplateId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("RunId"); @@ -3382,43 +3334,41 @@ namespace ERPCore.Migrations { b.Property("TemplateId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TemplateId")); b.Property("Annotations") - .HasColumnType("jsonb"); + .HasColumnType("longtext"); b.Property("Code") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Description") .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("Name") .IsRequired() .HasMaxLength(150) - .HasColumnType("character varying(150)"); + .HasColumnType("varchar(150)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("TemplateId"); @@ -3436,86 +3386,84 @@ namespace ERPCore.Migrations { b.Property("PurchaseInvoiceId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PurchaseInvoiceId")); b.Property("BalanceAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("GrandTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("PaidAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Draft"); b.Property("Subtotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("VatTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("VendorId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("VendorInvoiceNo") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("VendorSnapshotName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("VendorSnapshotTaxNo") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.HasKey("PurchaseInvoiceId"); @@ -3539,27 +3487,27 @@ namespace ERPCore.Migrations { b.Property("PurchaseInvoiceLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PurchaseInvoiceLineId")); b.Property("GrnId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LineTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Subtotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("VatTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.HasKey("PurchaseInvoiceLineId"); @@ -3575,41 +3523,41 @@ namespace ERPCore.Migrations { b.Property("PurchaseInvoicePaymentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PurchaseInvoicePaymentId")); b.Property("Amount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("BankAccountName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("GlBankAccountId") .HasColumnType("bigint"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Reference") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.HasKey("PurchaseInvoicePaymentId"); @@ -3624,55 +3572,53 @@ namespace ERPCore.Migrations { b.Property("PoId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PoId")); b.Property("ApprovalRequired") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ApprovedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ApproverUserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("RequisitionId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("VendorId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("PoId"); @@ -3698,41 +3644,41 @@ namespace ERPCore.Migrations { b.Property("ReturnId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ReturnId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ReasonCodeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("VendorId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ReturnId"); @@ -3754,22 +3700,22 @@ namespace ERPCore.Migrations { b.Property("ReturnLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ReturnLineId")); b.Property("GrnLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ReturnId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ReturnLineId"); @@ -3786,24 +3732,24 @@ namespace ERPCore.Migrations { b.Property("ReasonCodeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ReasonCodeId")); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Context") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Description") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.HasKey("ReasonCodeId"); @@ -3817,28 +3763,28 @@ namespace ERPCore.Migrations { b.Property("RequisitionId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RequisitionId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("RequestedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("RequisitionId"); @@ -3858,22 +3804,22 @@ namespace ERPCore.Migrations { b.Property("ReqLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ReqLineId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RequiredBy") .HasColumnType("date"); b.Property("RequisitionId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ReqLineId"); @@ -3888,28 +3834,28 @@ namespace ERPCore.Migrations { b.Property("RfqId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RfqId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("RequisitionId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("RfqId"); @@ -3927,19 +3873,19 @@ namespace ERPCore.Migrations { b.Property("RfqLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RfqLineId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RfqId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("RfqLineId"); @@ -3954,47 +3900,45 @@ namespace ERPCore.Migrations { b.Property("RoleId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RoleId")); b.Property("AuthRoleId") - .HasColumnType("uuid") + .HasColumnType("char(36)") .HasColumnName("auth_role_id"); b.Property("Code") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("IsSystemRole") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("RoleId"); @@ -4010,14 +3954,14 @@ namespace ERPCore.Migrations modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => { b.Property("RoleId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PermissionId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Actions") .ValueGeneratedOnAdd() - .HasColumnType("integer") + .HasColumnType("int") .HasDefaultValue(31); b.HasKey("RoleId", "PermissionId"); @@ -4031,18 +3975,18 @@ namespace ERPCore.Migrations { b.Property("RunEdgeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RunEdgeId")); b.Property("ChildRunStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ParentRunStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RunId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("RunEdgeId"); @@ -4060,59 +4004,57 @@ namespace ERPCore.Migrations { b.Property("RunStageId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RunStageId")); b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EstimatedMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("FieldDefs") .IsRequired() - .HasColumnType("jsonb"); + .HasColumnType("longtext"); b.Property("FieldValues") - .HasColumnType("jsonb"); + .HasColumnType("longtext"); b.Property("Name") .IsRequired() .HasMaxLength(150) - .HasColumnType("character varying(150)"); + .HasColumnType("varchar(150)"); b.Property("PosX") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("PosY") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RoleLabel") .HasMaxLength(60) - .HasColumnType("character varying(60)"); + .HasColumnType("varchar(60)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("RunId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("TemplateStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("RunStageId"); @@ -4127,33 +4069,33 @@ namespace ERPCore.Migrations { b.Property("EventId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EventId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EventType") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Note") .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("Payload") - .HasColumnType("jsonb"); + .HasColumnType("longtext"); b.Property("RunId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RunStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("UserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("EventId"); @@ -4170,52 +4112,52 @@ namespace ERPCore.Migrations { b.Property("RunInputId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RunInputId")); b.Property("ConsumedQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ConsumedValue") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("DeliveredQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("FromRunOutputId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PlannedQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("QtyUnit") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("ReturnedQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ReturnedValue") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RunStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Source") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("RunInputId"); @@ -4232,42 +4174,42 @@ namespace ERPCore.Migrations { b.Property("RunOutputId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RunOutputId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Name") .IsRequired() .HasMaxLength(150) - .HasColumnType("character varying(150)"); + .HasColumnType("varchar(150)"); b.Property("PlannedQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ProducedQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RunStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ScrappedQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("TransferredQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("UomId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("RunOutputId"); @@ -4286,49 +4228,47 @@ namespace ERPCore.Migrations { b.Property("SalaryComponentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SalaryComponentId")); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("ComponentType") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("IsTaxable") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("SalaryComponentId"); @@ -4344,75 +4284,73 @@ namespace ERPCore.Migrations { b.Property("SalesDayEndId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SalesDayEndId")); b.Property("BalanceTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("BundleCount") .ValueGeneratedOnAdd() - .HasColumnType("integer") + .HasColumnType("int") .HasDefaultValue(0); b.Property("BusinessDate") .HasColumnType("date"); b.Property("CashierUserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ClosedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CostOfGoodsSold") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("DiscountTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("GrandTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("PaidTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SlipCount") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Subtotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("TaxTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.HasKey("SalesDayEndId"); @@ -4431,106 +4369,104 @@ namespace ERPCore.Migrations { b.Property("SalesInvoiceId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SalesInvoiceId")); b.Property("BalanceAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatorUserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CustomerId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CustomerSnapshotName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("CustomerSnapshotTaxNo") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("DiscountTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("GrandTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("InvoiceNo") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("InvoiceType") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("B2C"); b.Property("NetPayable") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("PaidAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RoundOff") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Draft"); b.Property("Subtotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("TaxTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("SalesInvoiceId"); @@ -4556,83 +4492,81 @@ namespace ERPCore.Migrations { b.Property("SalesInvoiceLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SalesInvoiceLineId")); b.Property("BaseCost") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("Description") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("DiscountAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("DiscountMode") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DiscountPct") .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); + .HasColumnType("decimal(9,4)"); b.Property("FreeQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("IsFreeIssue") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LineTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("NetUnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ParentLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PriceSource") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SalesInvoiceId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("TaxAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("TaxPct") .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); + .HasColumnType("decimal(9,4)"); b.Property("UnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("SalesInvoiceLineId"); @@ -4649,41 +4583,41 @@ namespace ERPCore.Migrations { b.Property("SalesInvoicePaymentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SalesInvoicePaymentId")); b.Property("Amount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("BankAccountName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("GlBankAccountId") .HasColumnType("bigint"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Reference") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("SalesInvoiceId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("SalesInvoicePaymentId"); @@ -4698,41 +4632,41 @@ namespace ERPCore.Migrations { b.Property("ReturnId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ReturnId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CustomerId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ReasonCodeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ReturnId"); @@ -4754,22 +4688,22 @@ namespace ERPCore.Migrations { b.Property("ReturnLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ReturnLineId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ReturnId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ReturnLineId"); @@ -4786,77 +4720,75 @@ namespace ERPCore.Migrations { b.Property("SalesSlipId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SalesSlipId")); b.Property("BalanceAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("CashierUserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CustomerId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CustomerSnapshotName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("DayEndId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DiscountTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("GrandTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("PaidAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("SlipNo") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Draft"); b.Property("Subtotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("TaxTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("SalesSlipId"); @@ -4882,89 +4814,87 @@ namespace ERPCore.Migrations { b.Property("SalesSlipLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SalesSlipLineId")); b.Property("BaseCost") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("BatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Description") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("DiscountAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("DiscountMode") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DiscountPct") .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); + .HasColumnType("decimal(9,4)"); b.Property("FreeQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("IsFreeIssue") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LineTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("NetUnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ParentLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PriceSource") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SalesSlipId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SerialId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("TaxAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("TaxPct") .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); + .HasColumnType("decimal(9,4)"); b.Property("UnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("SalesSlipLineId"); @@ -4985,26 +4915,26 @@ namespace ERPCore.Migrations { b.Property("SerialId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SerialId")); b.Property("Barcode") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SerialNo") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("SerialId"); @@ -5021,18 +4951,18 @@ namespace ERPCore.Migrations { b.Property("EdgeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EdgeId")); b.Property("ChildStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ParentStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("TemplateId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("EdgeId"); @@ -5050,32 +4980,32 @@ namespace ERPCore.Migrations { b.Property("InputId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("InputId")); b.Property("FromOutputId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("QtyPerBatch") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("QtyUnit") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Source") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("StageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("InputId"); @@ -5092,27 +5022,27 @@ namespace ERPCore.Migrations { b.Property("OutputId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OutputId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Name") .IsRequired() .HasMaxLength(150) - .HasColumnType("character varying(150)"); + .HasColumnType("varchar(150)"); b.Property("QtyPerBatch") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("StageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("UomId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("OutputId"); @@ -5129,47 +5059,45 @@ namespace ERPCore.Migrations { b.Property("AdjustmentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("AdjustmentId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ReasonCodeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("AdjustmentId"); @@ -5191,28 +5119,28 @@ namespace ERPCore.Migrations { b.Property("AdjLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("AdjLineId")); b.Property("AdjustmentId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BinId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("QtyDelta") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("SerialId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("AdjLineId"); @@ -5233,42 +5161,40 @@ namespace ERPCore.Migrations { b.Property("CountId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CountId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CountType") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("CountId"); @@ -5290,36 +5216,36 @@ namespace ERPCore.Migrations { b.Property("CountLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CountLineId")); b.Property("BatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BinId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CountId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CountedQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SerialId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SystemQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("Variance") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.HasKey("CountLineId"); @@ -5340,39 +5266,39 @@ namespace ERPCore.Migrations { b.Property("LayerId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("LayerId")); b.Property("BatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("GrnLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("QtyReceived") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("QtyRemaining") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("SerialId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("UnitCost") .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); + .HasColumnType("decimal(18,6)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("LayerId"); @@ -5393,59 +5319,59 @@ namespace ERPCore.Migrations { b.Property("LedgerId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("LedgerId")); b.Property("BatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BinId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Direction") .IsRequired() .HasMaxLength(5) - .HasColumnType("character varying(5)"); + .HasColumnType("varchar(5)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("QtyBase") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RunningBalance") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("SerialId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SourceDocId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SourceDocType") .IsRequired() .HasMaxLength(10) - .HasColumnType("character varying(10)"); + .HasColumnType("varchar(10)"); b.Property("UnitCost") .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); + .HasColumnType("decimal(18,6)"); b.Property("UserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Value") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("LedgerId"); @@ -5472,40 +5398,38 @@ namespace ERPCore.Migrations { b.Property("TransferId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TransferId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DestWarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SrcWarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("TransferId"); @@ -5529,39 +5453,39 @@ namespace ERPCore.Migrations { b.Property("TransferLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TransferLineId")); b.Property("BatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DestBinId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("QtyReceived") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("SerialId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SrcBinId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("TransferId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("UnitCost") .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); + .HasColumnType("decimal(18,6)"); b.HasKey("TransferLineId"); @@ -5584,36 +5508,34 @@ namespace ERPCore.Migrations { b.Property("SubCategoryId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SubCategoryId")); b.Property("CategoryId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("SubCategoryId"); @@ -5629,39 +5551,39 @@ namespace ERPCore.Migrations { b.Property("SubNavItemId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SubNavItemId")); b.Property("Code") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Href") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("Icon") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Label") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("NavItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SortOrder") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.HasKey("SubNavItemId"); @@ -6100,37 +6022,35 @@ namespace ERPCore.Migrations { b.Property("TicketId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TicketId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Subject") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UpdatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("TicketId"); @@ -6145,26 +6065,26 @@ namespace ERPCore.Migrations { b.Property("MessageId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("MessageId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("IsFromAdmin") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("Message") .IsRequired() .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); + .HasColumnType("varchar(2000)"); b.Property("SenderUserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("TicketId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("MessageId"); @@ -6177,42 +6097,40 @@ namespace ERPCore.Migrations { b.Property("TaxRateId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TaxRateId")); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("Percentage") .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); + .HasColumnType("decimal(5,2)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("TaxRateId"); @@ -6231,7 +6149,7 @@ namespace ERPCore.Migrations CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), Name = "Standard", Percentage = 15m, - RowVersion = 0u, + RowVersion = 1u, Status = "Active" }, new @@ -6241,7 +6159,7 @@ namespace ERPCore.Migrations CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), Name = "Zero-Rated", Percentage = 0m, - RowVersion = 0u, + RowVersion = 1u, Status = "Active" }, new @@ -6251,7 +6169,7 @@ namespace ERPCore.Migrations CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), Name = "Exempt", Percentage = 0m, - RowVersion = 0u, + RowVersion = 1u, Status = "Active" }); }); @@ -6260,36 +6178,34 @@ namespace ERPCore.Migrations { b.Property("TaxSlabId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TaxSlabId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("LowerBound") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("Rate") .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); + .HasColumnType("decimal(6,4)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("UpperBound") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.HasKey("TaxSlabId"); @@ -6302,36 +6218,36 @@ namespace ERPCore.Migrations { b.Property("StageId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("StageId")); b.Property("EstimatedMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("FieldDefs") .IsRequired() - .HasColumnType("jsonb"); + .HasColumnType("longtext"); b.Property("Name") .IsRequired() .HasMaxLength(150) - .HasColumnType("character varying(150)"); + .HasColumnType("varchar(150)"); b.Property("PosX") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("PosY") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RoleLabel") .HasMaxLength(60) - .HasColumnType("character varying(60)"); + .HasColumnType("varchar(60)"); b.Property("TemplateId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("StageId"); @@ -6344,20 +6260,35 @@ namespace ERPCore.Migrations { b.Property("UomId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("UomId")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); + + b.Property("Status") + .IsRequired() + .ValueGeneratedOnAdd() + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasDefaultValue("Active"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); b.HasKey("UomId"); b.HasIndex("Name") .IsUnique(); + b.HasIndex("Status"); + b.ToTable("uoms", (string)null); }); @@ -6365,35 +6296,35 @@ namespace ERPCore.Migrations { b.Property("UserId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("UserId")); b.Property("AuthUserId") - .HasColumnType("uuid") + .HasColumnType("char(36)") .HasColumnName("auth_user_id"); b.Property("DisplayName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("Email") .HasMaxLength(320) - .HasColumnType("character varying(320)"); + .HasColumnType("varchar(320)"); b.Property("RoleId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Username") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.HasKey("UserId"); @@ -6424,56 +6355,54 @@ namespace ERPCore.Migrations { b.Property("VendorId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("VendorId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Code") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Currency") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(3) - .HasColumnType("character varying(3)") + .HasColumnType("varchar(3)") .HasDefaultValue("LKR"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("TaxReg") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Terms") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("VendorId"); @@ -6491,18 +6420,18 @@ namespace ERPCore.Migrations { b.Property("QuotationId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("QuotationId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("RfqId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("VendorId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("QuotationId"); @@ -6518,22 +6447,22 @@ namespace ERPCore.Migrations { b.Property("QuotationLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("QuotationLineId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LeadDays") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("QuotationId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("UnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.HasKey("QuotationLineId"); @@ -6548,28 +6477,28 @@ namespace ERPCore.Migrations { b.Property("WarehouseId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("WarehouseId")); b.Property("Address") - .HasColumnType("text"); + .HasColumnType("longtext"); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Code") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("Phone") - .HasColumnType("text"); + .HasColumnType("longtext"); b.HasKey("WarehouseId"); @@ -6585,63 +6514,61 @@ namespace ERPCore.Migrations { b.Property("WorkShiftId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("WorkShiftId")); b.Property("BreakMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EndTime") - .HasColumnType("interval"); + .HasColumnType("time(6)"); b.Property("GraceMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("IsOvernight") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("OtMultiplier") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("StartTime") - .HasColumnType("interval"); + .HasColumnType("time(6)"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("WorkingDaysMask") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("WorkShiftId"); diff --git a/Backend/ERPCore/Migrations/20260811053751_initial.cs b/Backend/ERPCore/Migrations/20261005031409_Baseline_MySql.cs similarity index 50% rename from Backend/ERPCore/Migrations/20260811053751_initial.cs rename to Backend/ERPCore/Migrations/20261005031409_Baseline_MySql.cs index 326ed1d..d61f6bf 100644 --- a/Backend/ERPCore/Migrations/20260811053751_initial.cs +++ b/Backend/ERPCore/Migrations/20261005031409_Baseline_MySql.cs @@ -1,6 +1,6 @@ using System; +using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable @@ -9,7 +9,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace ERPCore.Migrations { /// - public partial class initial : Migration + public partial class Baseline_MySql : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) @@ -18,430 +18,463 @@ namespace ERPCore.Migrations name: "brands", columns: table => new { - BrandId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + BrandId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_brands", x => x.BrandId); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "bundle_sale_templates", columns: table => new { - BundleSaleTemplateId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - TemplateCode = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - TemplateName = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Description = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - ConcurrencyStamp = table.Column(type: "integer", nullable: false, defaultValue: 0) + BundleSaleTemplateId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + TemplateCode = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"), + TemplateName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + Description = table.Column(type: "varchar(1000)", maxLength: 1000, nullable: true, collation: "utf8mb4_unicode_ci"), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_bundle_sale_templates", x => x.BundleSaleTemplateId); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "categories", columns: table => new { - CategoryId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + CategoryId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_categories", x => x.CategoryId); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_attendance_upload_batches", columns: table => new { - AttendanceUploadBatchId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - DocNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: false), - PeriodStart = table.Column(type: "timestamp with time zone", nullable: false), - PeriodEnd = table.Column(type: "timestamp with time zone", nullable: false), - SourceType = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - OriginalFileName = table.Column(type: "character varying(260)", maxLength: 260, nullable: true), - UploadedBy = table.Column(type: "integer", nullable: false), - UploadedAt = table.Column(type: "timestamp with time zone", nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - ConfirmedBy = table.Column(type: "integer", nullable: true), - ConfirmedAt = table.Column(type: "timestamp with time zone", nullable: true), - RowCountTotal = table.Column(type: "integer", nullable: false), - RowCountDuplicate = table.Column(type: "integer", nullable: false), - RowCountError = table.Column(type: "integer", nullable: false), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + AttendanceUploadBatchId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DocNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: false, collation: "utf8mb4_unicode_ci"), + PeriodStart = table.Column(type: "datetime(6)", nullable: false), + PeriodEnd = table.Column(type: "datetime(6)", nullable: false), + SourceType = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + OriginalFileName = table.Column(type: "varchar(260)", maxLength: 260, nullable: true, collation: "utf8mb4_unicode_ci"), + UploadedBy = table.Column(type: "int", nullable: false), + UploadedAt = table.Column(type: "datetime(6)", nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + ConfirmedBy = table.Column(type: "int", nullable: true), + ConfirmedAt = table.Column(type: "datetime(6)", nullable: true), + RowCountTotal = table.Column(type: "int", nullable: false), + RowCountDuplicate = table.Column(type: "int", nullable: false), + RowCountError = table.Column(type: "int", nullable: false), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_hr_attendance_upload_batches", x => x.AttendanceUploadBatchId); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_branches", columns: table => new { - BranchId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Code = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Address = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + BranchId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Code = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + Address = table.Column(type: "varchar(500)", maxLength: 500, nullable: true, collation: "utf8mb4_unicode_ci"), + PhoneNumber = table.Column(type: "varchar(30)", maxLength: 30, nullable: true, collation: "utf8mb4_unicode_ci"), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_hr_branches", x => x.BranchId); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_designations", columns: table => new { - DesignationId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Code = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + DesignationId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Code = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_hr_designations", x => x.DesignationId); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_document_types", columns: table => new { - HrDocumentTypeId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Code = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Category = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - RequiredAtOnboarding = table.Column(type: "boolean", nullable: false), - ExpiryTracked = table.Column(type: "boolean", nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + HrDocumentTypeId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Code = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + Category = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + RequiredAtOnboarding = table.Column(type: "tinyint(1)", nullable: false), + ExpiryTracked = table.Column(type: "tinyint(1)", nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_hr_document_types", x => x.HrDocumentTypeId); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_employment_types", columns: table => new { - EmploymentTypeId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Code = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + EmploymentTypeId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Code = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_hr_employment_types", x => x.EmploymentTypeId); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_leave_types", columns: table => new { - LeaveTypeId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Code = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - IsPaid = table.Column(type: "boolean", nullable: false), - CountsAsNoPay = table.Column(type: "boolean", nullable: false), - AccrualPerYear = table.Column(type: "numeric(6,2)", precision: 6, scale: 2, nullable: false), - CarryForwardAllowed = table.Column(type: "boolean", nullable: false), - MaxCarryForwardDays = table.Column(type: "integer", nullable: true), - RequiresApproval = table.Column(type: "boolean", nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + LeaveTypeId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Code = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + IsPaid = table.Column(type: "tinyint(1)", nullable: false), + CountsAsNoPay = table.Column(type: "tinyint(1)", nullable: false), + AccrualPerYear = table.Column(type: "decimal(6,2)", precision: 6, scale: 2, nullable: false), + CarryForwardAllowed = table.Column(type: "tinyint(1)", nullable: false), + MaxCarryForwardDays = table.Column(type: "int", nullable: true), + RequiresApproval = table.Column(type: "tinyint(1)", nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_hr_leave_types", x => x.LeaveTypeId); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_payroll_statutory_settings", columns: table => new { - PayrollStatutorySettingId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - EpfEmployeeRate = table.Column(type: "numeric(6,4)", precision: 6, scale: 4, nullable: false), - EpfEmployerRate = table.Column(type: "numeric(6,4)", precision: 6, scale: 4, nullable: false), - EtfEmployerRate = table.Column(type: "numeric(6,4)", precision: 6, scale: 4, nullable: false), - OtMultiplierDefault = table.Column(type: "numeric(6,2)", precision: 6, scale: 2, nullable: false), - EffectiveFrom = table.Column(type: "timestamp with time zone", nullable: false), - EffectiveTo = table.Column(type: "timestamp with time zone", nullable: true), - CreatedBy = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + PayrollStatutorySettingId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + EpfEmployeeRate = table.Column(type: "decimal(6,4)", precision: 6, scale: 4, nullable: false), + EpfEmployerRate = table.Column(type: "decimal(6,4)", precision: 6, scale: 4, nullable: false), + EtfEmployerRate = table.Column(type: "decimal(6,4)", precision: 6, scale: 4, nullable: false), + OtMultiplierDefault = table.Column(type: "decimal(6,2)", precision: 6, scale: 2, nullable: false), + EffectiveFrom = table.Column(type: "datetime(6)", nullable: false), + EffectiveTo = table.Column(type: "datetime(6)", nullable: true), + CreatedBy = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_hr_payroll_statutory_settings", x => x.PayrollStatutorySettingId); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_salary_components", columns: table => new { - SalaryComponentId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Code = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - ComponentType = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - IsTaxable = table.Column(type: "boolean", nullable: false), - IsEpfEtfApplicable = table.Column(type: "boolean", nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + SalaryComponentId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Code = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + ComponentType = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + IsTaxable = table.Column(type: "tinyint(1)", nullable: false), + IsEpfEtfApplicable = table.Column(type: "tinyint(1)", nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_hr_salary_components", x => x.SalaryComponentId); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_tax_slabs", columns: table => new { - TaxSlabId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - EffectiveFrom = table.Column(type: "timestamp with time zone", nullable: false), - EffectiveTo = table.Column(type: "timestamp with time zone", nullable: true), - LowerBound = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - UpperBound = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true), - Rate = table.Column(type: "numeric(6,4)", precision: 6, scale: 4, nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + TaxSlabId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + EffectiveFrom = table.Column(type: "datetime(6)", nullable: false), + EffectiveTo = table.Column(type: "datetime(6)", nullable: true), + LowerBound = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + UpperBound = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: true), + Rate = table.Column(type: "decimal(6,4)", precision: 6, scale: 4, nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_hr_tax_slabs", x => x.TaxSlabId); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_work_shifts", columns: table => new { - WorkShiftId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Code = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - StartTime = table.Column(type: "interval", nullable: false), - EndTime = table.Column(type: "interval", nullable: false), - IsOvernight = table.Column(type: "boolean", nullable: false), - GraceMinutes = table.Column(type: "integer", nullable: false), - BreakMinutes = table.Column(type: "integer", nullable: false), - StandardWorkingMinutes = table.Column(type: "integer", nullable: false), - OtMultiplier = table.Column(type: "numeric(6,2)", precision: 6, scale: 2, nullable: false), - WorkingDaysMask = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + WorkShiftId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Code = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + StartTime = table.Column(type: "time(6)", nullable: false), + EndTime = table.Column(type: "time(6)", nullable: false), + IsOvernight = table.Column(type: "tinyint(1)", nullable: false), + GraceMinutes = table.Column(type: "int", nullable: false), + BreakMinutes = table.Column(type: "int", nullable: false), + StandardWorkingMinutes = table.Column(type: "int", nullable: false), + OtMultiplier = table.Column(type: "decimal(6,2)", precision: 6, scale: 2, nullable: false), + WorkingDaysMask = table.Column(type: "int", nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_hr_work_shifts", x => x.WorkShiftId); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "item_types", columns: table => new { - ItemTypeId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + ItemTypeId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + IsMeasurable = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_item_types", x => x.ItemTypeId); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "journal_entry_stubs", columns: table => new { - JournalId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - SourceDocType = table.Column(type: "character varying(10)", maxLength: 10, nullable: false), - SourceDocId = table.Column(type: "integer", nullable: false), - DebitAccount = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - CreditAccount = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - Amount = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false) + JournalId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + SourceDocType = table.Column(type: "varchar(10)", maxLength: 10, nullable: false, collation: "utf8mb4_unicode_ci"), + SourceDocId = table.Column(type: "int", nullable: false), + DebitAccount = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + CreditAccount = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + Amount = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false) }, constraints: table => { table.PrimaryKey("PK_journal_entry_stubs", x => x.JournalId); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "nav_items", columns: table => new { - NavItemId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Code = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - Label = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), - Icon = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), - Href = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), - SortOrder = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active") + NavItemId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Code = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"), + Label = table.Column(type: "varchar(100)", maxLength: 100, nullable: false, collation: "utf8mb4_unicode_ci"), + Icon = table.Column(type: "varchar(50)", maxLength: 50, nullable: true, collation: "utf8mb4_unicode_ci"), + Href = table.Column(type: "varchar(200)", maxLength: 200, nullable: true, collation: "utf8mb4_unicode_ci"), + SortOrder = table.Column(type: "int", nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci") }, constraints: table => { table.PrimaryKey("PK_nav_items", x => x.NavItemId); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( - name: "number_sequences", + name: "notifications", columns: table => new { - SequenceId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - doc_type = table.Column(type: "character varying(10)", maxLength: 10, nullable: false), - year = table.Column(type: "integer", nullable: false), - last_number = table.Column(type: "integer", nullable: false) + NotificationId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ModuleKey = table.Column(type: "varchar(100)", maxLength: 100, nullable: false, collation: "utf8mb4_unicode_ci"), + Title = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + Message = table.Column(type: "varchar(1000)", maxLength: 1000, nullable: false, collation: "utf8mb4_unicode_ci"), + RelatedEntityType = table.Column(type: "varchar(100)", maxLength: 100, nullable: true, collation: "utf8mb4_unicode_ci"), + RelatedEntityId = table.Column(type: "int", nullable: true), + CreatedAt = table.Column(type: "datetime(6)", nullable: false) }, constraints: table => { - table.PrimaryKey("PK_number_sequences", x => x.SequenceId); - }); + table.PrimaryKey("PK_notifications", x => x.NotificationId); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "reason_codes", columns: table => new { - ReasonCodeId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Code = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - Description = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Context = table.Column(type: "character varying(20)", maxLength: 20, nullable: false) + ReasonCodeId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Code = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + Description = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + Context = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci") }, constraints: table => { table.PrimaryKey("PK_reason_codes", x => x.ReasonCodeId); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "roles", columns: table => new { - RoleId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - auth_role_id = table.Column(type: "uuid", nullable: false), - Code = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - IsSystemRole = table.Column(type: "boolean", nullable: false, defaultValue: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + RoleId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + auth_role_id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Code = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"), + Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + IsSystemRole = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_roles", x => x.RoleId); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "support_tickets", + columns: table => new + { + TicketId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Subject = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + CreatedBy = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedBy = table.Column(type: "int", nullable: true), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_support_tickets", x => x.TicketId); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "tax_rates", + columns: table => new + { + TaxRateId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Code = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + Name = table.Column(type: "varchar(100)", maxLength: 100, nullable: false, collation: "utf8mb4_unicode_ci"), + Percentage = table.Column(type: "decimal(5,2)", precision: 5, scale: 2, nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_tax_rates", x => x.TaxRateId); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "uoms", columns: table => new { - UomId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Name = table.Column(type: "character varying(50)", maxLength: 50, nullable: false) + UomId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_uoms", x => x.UomId); - }); - - migrationBuilder.CreateTable( - name: "vendors", - columns: table => new - { - VendorId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Code = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Terms = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), - TaxReg = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), - Currency = table.Column(type: "character varying(3)", maxLength: 3, nullable: false, defaultValue: "LKR"), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_vendors", x => x.VendorId); - }); - - migrationBuilder.CreateTable( - name: "warehouses", - columns: table => new - { - WarehouseId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Code = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_warehouses", x => x.WarehouseId); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "subcategories", columns: table => new { - SubCategoryId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - CategoryId = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + SubCategoryId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + CategoryId = table.Column(type: "int", nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { @@ -452,29 +485,30 @@ namespace ERPCore.Migrations principalTable: "categories", principalColumn: "CategoryId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_payroll_runs", columns: table => new { - PayrollRunId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - DocNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: false), - PeriodYear = table.Column(type: "integer", nullable: false), - PeriodMonth = table.Column(type: "integer", nullable: false), - BranchId = table.Column(type: "integer", nullable: true), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - GeneratedBy = table.Column(type: "integer", nullable: false), - GeneratedAt = table.Column(type: "timestamp with time zone", nullable: false), - ApprovedBy = table.Column(type: "integer", nullable: true), - ApprovedAt = table.Column(type: "timestamp with time zone", nullable: true), - LockedBy = table.Column(type: "integer", nullable: true), - LockedAt = table.Column(type: "timestamp with time zone", nullable: true), - UnlockedBy = table.Column(type: "integer", nullable: true), - UnlockedAt = table.Column(type: "timestamp with time zone", nullable: true), - UnlockReason = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + PayrollRunId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DocNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: false, collation: "utf8mb4_unicode_ci"), + PeriodYear = table.Column(type: "int", nullable: false), + PeriodMonth = table.Column(type: "int", nullable: false), + BranchId = table.Column(type: "int", nullable: true), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + GeneratedBy = table.Column(type: "int", nullable: false), + GeneratedAt = table.Column(type: "datetime(6)", nullable: false), + ApprovedBy = table.Column(type: "int", nullable: true), + ApprovedAt = table.Column(type: "datetime(6)", nullable: true), + LockedBy = table.Column(type: "int", nullable: true), + LockedAt = table.Column(type: "datetime(6)", nullable: true), + UnlockedBy = table.Column(type: "int", nullable: true), + UnlockedAt = table.Column(type: "datetime(6)", nullable: true), + UnlockReason = table.Column(type: "varchar(500)", maxLength: 500, nullable: true, collation: "utf8mb4_unicode_ci"), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { @@ -485,21 +519,98 @@ namespace ERPCore.Migrations principalTable: "hr_branches", principalColumn: "BranchId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "number_sequences", + columns: table => new + { + SequenceId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + doc_type = table.Column(type: "varchar(10)", maxLength: 10, nullable: false, collation: "utf8mb4_unicode_ci"), + branch_id = table.Column(type: "int", nullable: false), + year = table.Column(type: "int", nullable: false), + last_number = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_number_sequences", x => x.SequenceId); + table.ForeignKey( + name: "FK_number_sequences_hr_branches_branch_id", + column: x => x.branch_id, + principalTable: "hr_branches", + principalColumn: "BranchId", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "vendors", + columns: table => new + { + VendorId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Code = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"), + Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + Terms = table.Column(type: "varchar(50)", maxLength: 50, nullable: true, collation: "utf8mb4_unicode_ci"), + TaxReg = table.Column(type: "varchar(50)", maxLength: 50, nullable: true, collation: "utf8mb4_unicode_ci"), + Currency = table.Column(type: "varchar(3)", maxLength: 3, nullable: false, defaultValue: "LKR", collation: "utf8mb4_unicode_ci"), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + BranchId = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_vendors", x => x.VendorId); + table.ForeignKey( + name: "FK_vendors_hr_branches_BranchId", + column: x => x.BranchId, + principalTable: "hr_branches", + principalColumn: "BranchId", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "warehouses", + columns: table => new + { + WarehouseId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Code = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"), + Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + Address = table.Column(type: "longtext", nullable: true, collation: "utf8mb4_unicode_ci"), + Phone = table.Column(type: "longtext", nullable: true, collation: "utf8mb4_unicode_ci"), + BranchId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_warehouses", x => x.WarehouseId); + table.ForeignKey( + name: "FK_warehouses_hr_branches_BranchId", + column: x => x.BranchId, + principalTable: "hr_branches", + principalColumn: "BranchId", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "sub_nav_items", columns: table => new { - SubNavItemId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - NavItemId = table.Column(type: "integer", nullable: false), - Code = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - Label = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), - Icon = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), - Href = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), - SortOrder = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active") + SubNavItemId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + NavItemId = table.Column(type: "int", nullable: false), + Code = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"), + Label = table.Column(type: "varchar(100)", maxLength: 100, nullable: false, collation: "utf8mb4_unicode_ci"), + Icon = table.Column(type: "varchar(50)", maxLength: 50, nullable: true, collation: "utf8mb4_unicode_ci"), + Href = table.Column(type: "varchar(200)", maxLength: 200, nullable: true, collation: "utf8mb4_unicode_ci"), + SortOrder = table.Column(type: "int", nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci") }, constraints: table => { @@ -510,20 +621,21 @@ namespace ERPCore.Migrations principalTable: "nav_items", principalColumn: "NavItemId", onDelete: ReferentialAction.Cascade); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "users", columns: table => new { - UserId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Username = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), - DisplayName = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - auth_user_id = table.Column(type: "uuid", nullable: true), - Email = table.Column(type: "character varying(320)", maxLength: 320, nullable: true), - RoleId = table.Column(type: "integer", nullable: true) + UserId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Username = table.Column(type: "varchar(100)", maxLength: 100, nullable: false, collation: "utf8mb4_unicode_ci"), + DisplayName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + auth_user_id = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + Email = table.Column(type: "varchar(320)", maxLength: 320, nullable: true, collation: "utf8mb4_unicode_ci"), + RoleId = table.Column(type: "int", nullable: true) }, constraints: table => { @@ -534,91 +646,64 @@ namespace ERPCore.Migrations principalTable: "roles", principalColumn: "RoleId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( - name: "bins", + name: "support_ticket_messages", columns: table => new { - BinId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - WarehouseId = table.Column(type: "integer", nullable: false), - Code = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - BinType = table.Column(type: "character varying(50)", maxLength: 50, nullable: true) + MessageId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + TicketId = table.Column(type: "int", nullable: false), + SenderUserId = table.Column(type: "int", nullable: false), + IsFromAdmin = table.Column(type: "tinyint(1)", nullable: false), + Message = table.Column(type: "varchar(2000)", maxLength: 2000, nullable: false, collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false) }, constraints: table => { - table.PrimaryKey("PK_bins", x => x.BinId); + table.PrimaryKey("PK_support_ticket_messages", x => x.MessageId); table.ForeignKey( - name: "FK_bins_warehouses_WarehouseId", - column: x => x.WarehouseId, - principalTable: "warehouses", - principalColumn: "WarehouseId", + name: "FK_support_ticket_messages_support_tickets_TicketId", + column: x => x.TicketId, + principalTable: "support_tickets", + principalColumn: "TicketId", onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "customers", - columns: table => new - { - CustomerId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - CustomerCode = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - CustomerType = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "B2C"), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - DisplayName = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), - Phone = table.Column(type: "character varying(30)", maxLength: 30, nullable: true), - Email = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), - AddressLine1 = table.Column(type: "character varying(250)", maxLength: 250, nullable: true), - AddressLine2 = table.Column(type: "character varying(250)", maxLength: 250, nullable: true), - City = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), - Country = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), - TaxRegistrationNo = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), - CreditLimit = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - CreditDays = table.Column(type: "integer", nullable: false), - DefaultWarehouseId = table.Column(type: "integer", nullable: true), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_customers", x => x.CustomerId); - table.ForeignKey( - name: "FK_customers_warehouses_DefaultWarehouseId", - column: x => x.DefaultWarehouseId, - principalTable: "warehouses", - principalColumn: "WarehouseId", - onDelete: ReferentialAction.SetNull); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "items", columns: table => new { - ItemId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Sku = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Description = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), - CategoryId = table.Column(type: "integer", nullable: false), - SubCategoryId = table.Column(type: "integer", nullable: true), - BrandId = table.Column(type: "integer", nullable: true), - BaseUomId = table.Column(type: "integer", nullable: false), - DefaultVendorId = table.Column(type: "integer", nullable: true), - StockNature = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - TrackingMode = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - TaxClass = table.Column(type: "character varying(20)", maxLength: 20, nullable: true), - SalePrice = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: true), - ContentQty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: true), - ContentUnit = table.Column(type: "character varying(20)", maxLength: 20, nullable: true), - ContentBaseQty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: true), - ContentBaseUnit = table.Column(type: "character varying(20)", maxLength: 20, nullable: true), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + ItemId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Sku = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"), + Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + Description = table.Column(type: "varchar(1000)", maxLength: 1000, nullable: true, collation: "utf8mb4_unicode_ci"), + Barcode = table.Column(type: "varchar(100)", maxLength: 100, nullable: true, collation: "utf8mb4_unicode_ci"), + CategoryId = table.Column(type: "int", nullable: false), + SubCategoryId = table.Column(type: "int", nullable: true), + BrandId = table.Column(type: "int", nullable: true), + BaseUomId = table.Column(type: "int", nullable: false), + DefaultVendorId = table.Column(type: "int", nullable: true), + StockNature = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + TrackingMode = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + Warranty = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "NonWarranty", collation: "utf8mb4_unicode_ci"), + WarrantyPeriodMonths = table.Column(type: "int", nullable: true), + TaxRateId = table.Column(type: "int", nullable: true), + SellingMinPrice = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true), + SellingMaxPrice = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true), + SellingFlatPrice = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true), + ContentQty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true), + ContentUnit = table.Column(type: "varchar(20)", maxLength: 20, nullable: true, collation: "utf8mb4_unicode_ci"), + ContentBaseQty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true), + ContentBaseUnit = table.Column(type: "varchar(20)", maxLength: 20, nullable: true, collation: "utf8mb4_unicode_ci"), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { @@ -641,6 +726,12 @@ namespace ERPCore.Migrations principalTable: "subcategories", principalColumn: "SubCategoryId", onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_items_tax_rates_TaxRateId", + column: x => x.TaxRateId, + principalTable: "tax_rates", + principalColumn: "TaxRateId", + onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_items_uoms_BaseUomId", column: x => x.BaseUomId, @@ -653,17 +744,84 @@ namespace ERPCore.Migrations principalTable: "vendors", principalColumn: "VendorId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "bins", + columns: table => new + { + BinId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + WarehouseId = table.Column(type: "int", nullable: false), + Code = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"), + BinType = table.Column(type: "varchar(50)", maxLength: 50, nullable: true, collation: "utf8mb4_unicode_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_bins", x => x.BinId); + table.ForeignKey( + name: "FK_bins_warehouses_WarehouseId", + column: x => x.WarehouseId, + principalTable: "warehouses", + principalColumn: "WarehouseId", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "customers", + columns: table => new + { + CustomerId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CustomerCode = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"), + CustomerType = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "B2C", collation: "utf8mb4_unicode_ci"), + Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + DisplayName = table.Column(type: "varchar(200)", maxLength: 200, nullable: true, collation: "utf8mb4_unicode_ci"), + Phone = table.Column(type: "varchar(30)", maxLength: 30, nullable: true, collation: "utf8mb4_unicode_ci"), + Email = table.Column(type: "varchar(100)", maxLength: 100, nullable: true, collation: "utf8mb4_unicode_ci"), + AddressLine1 = table.Column(type: "varchar(250)", maxLength: 250, nullable: true, collation: "utf8mb4_unicode_ci"), + AddressLine2 = table.Column(type: "varchar(250)", maxLength: 250, nullable: true, collation: "utf8mb4_unicode_ci"), + City = table.Column(type: "varchar(100)", maxLength: 100, nullable: true, collation: "utf8mb4_unicode_ci"), + Country = table.Column(type: "varchar(100)", maxLength: 100, nullable: true, collation: "utf8mb4_unicode_ci"), + TaxRegistrationNo = table.Column(type: "varchar(50)", maxLength: 50, nullable: true, collation: "utf8mb4_unicode_ci"), + CreditLimit = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + CreditDays = table.Column(type: "int", nullable: false), + DefaultWarehouseId = table.Column(type: "int", nullable: true), + BranchId = table.Column(type: "int", nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_customers", x => x.CustomerId); + table.ForeignKey( + name: "FK_customers_hr_branches_BranchId", + column: x => x.BranchId, + principalTable: "hr_branches", + principalColumn: "BranchId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_customers_warehouses_DefaultWarehouseId", + column: x => x.DefaultWarehouseId, + principalTable: "warehouses", + principalColumn: "WarehouseId", + onDelete: ReferentialAction.SetNull); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "permissions", columns: table => new { - PermissionId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Code = table.Column(type: "character varying(80)", maxLength: 80, nullable: false), - NavItemId = table.Column(type: "integer", nullable: true), - SubNavItemId = table.Column(type: "integer", nullable: true) + PermissionId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Code = table.Column(type: "varchar(80)", maxLength: 80, nullable: false, collation: "utf8mb4_unicode_ci"), + NavItemId = table.Column(type: "int", nullable: true), + SubNavItemId = table.Column(type: "int", nullable: true) }, constraints: table => { @@ -680,20 +838,21 @@ namespace ERPCore.Migrations principalTable: "sub_nav_items", principalColumn: "SubNavItemId", onDelete: ReferentialAction.Cascade); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "audit_logs", columns: table => new { - AuditId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - UserId = table.Column(type: "integer", nullable: false), - EntityType = table.Column(type: "character varying(80)", maxLength: 80, nullable: false), - EntityId = table.Column(type: "integer", nullable: false), - Action = table.Column(type: "character varying(10)", maxLength: 10, nullable: false), - ChangeSet = table.Column(type: "jsonb", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) + AuditId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + UserId = table.Column(type: "int", nullable: false), + EntityType = table.Column(type: "varchar(80)", maxLength: 80, nullable: false, collation: "utf8mb4_unicode_ci"), + EntityId = table.Column(type: "int", nullable: false), + Action = table.Column(type: "varchar(10)", maxLength: 10, nullable: false, collation: "utf8mb4_unicode_ci"), + ChangeSet = table.Column(type: "longtext", nullable: false, collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false) }, constraints: table => { @@ -704,46 +863,151 @@ namespace ERPCore.Migrations principalTable: "users", principalColumn: "UserId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "branch_config", + columns: table => new + { + ConfigId = table.Column(type: "int", nullable: false), + BranchingEnabled = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), + WarehouseBranchingEnabled = table.Column(type: "tinyint(1)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + UpdatedBy = table.Column(type: "int", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_branch_config", x => x.ConfigId); + table.CheckConstraint("ck_branch_config_singleton", "`ConfigId` = 1"); + table.ForeignKey( + name: "FK_branch_config_users_UpdatedBy", + column: x => x.UpdatedBy, + principalTable: "users", + principalColumn: "UserId", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "login_activities", + columns: table => new + { + LoginActivityId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + UserId = table.Column(type: "int", nullable: false), + IpAddress = table.Column(type: "varchar(64)", maxLength: 64, nullable: true, collation: "utf8mb4_unicode_ci"), + UserAgent = table.Column(type: "varchar(500)", maxLength: 500, nullable: true, collation: "utf8mb4_unicode_ci"), + DeviceLabel = table.Column(type: "varchar(200)", maxLength: 200, nullable: true, collation: "utf8mb4_unicode_ci"), + LoginAt = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_login_activities", x => x.LoginActivityId); + table.ForeignKey( + name: "FK_login_activities_users_UserId", + column: x => x.UserId, + principalTable: "users", + principalColumn: "UserId", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "notification_config", + columns: table => new + { + NotificationConfigId = table.Column(type: "int", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + UpdatedBy = table.Column(type: "int", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_notification_config", x => x.NotificationConfigId); + table.CheckConstraint("ck_notification_config_singleton", "`NotificationConfigId` = 1"); + table.ForeignKey( + name: "FK_notification_config_users_UpdatedBy", + column: x => x.UpdatedBy, + principalTable: "users", + principalColumn: "UserId", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "notification_recipients", + columns: table => new + { + NotificationRecipientId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + NotificationId = table.Column(type: "int", nullable: false), + UserId = table.Column(type: "int", nullable: false), + IsRead = table.Column(type: "tinyint(1)", nullable: false), + ReadAt = table.Column(type: "datetime(6)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_notification_recipients", x => x.NotificationRecipientId); + table.ForeignKey( + name: "FK_notification_recipients_notifications_NotificationId", + column: x => x.NotificationId, + principalTable: "notifications", + principalColumn: "NotificationId", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_notification_recipients_users_UserId", + column: x => x.UserId, + principalTable: "users", + principalColumn: "UserId", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "product_config", columns: table => new { - ConfigId = table.Column(type: "integer", nullable: false), - SubcategoriesEnabled = table.Column(type: "boolean", nullable: false, defaultValue: true), - BrandsEnabled = table.Column(type: "boolean", nullable: false, defaultValue: true), - ItemTypesEnabled = table.Column(type: "boolean", nullable: false, defaultValue: true), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - UpdatedBy = table.Column(type: "integer", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + ConfigId = table.Column(type: "int", nullable: false), + SubcategoriesEnabled = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), + BrandsEnabled = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), + ItemTypesEnabled = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), + SellingPricesEnabled = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), + SerialNumbersEnabled = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), + BatchListsEnabled = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), + WarrantyPeriodsEnabled = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + UpdatedBy = table.Column(type: "int", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_product_config", x => x.ConfigId); - table.CheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); + table.CheckConstraint("ck_product_config_singleton", "`ConfigId` = 1"); table.ForeignKey( name: "FK_product_config_users_UpdatedBy", column: x => x.UpdatedBy, principalTable: "users", principalColumn: "UserId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "production_templates", columns: table => new { - TemplateId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Code = table.Column(type: "character varying(30)", maxLength: 30, nullable: false), - Name = table.Column(type: "character varying(150)", maxLength: 150, nullable: false), - Description = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - Annotations = table.Column(type: "jsonb", nullable: true), - CreatedBy = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + TemplateId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Code = table.Column(type: "varchar(30)", maxLength: 30, nullable: false, collation: "utf8mb4_unicode_ci"), + Name = table.Column(type: "varchar(150)", maxLength: 150, nullable: false, collation: "utf8mb4_unicode_ci"), + Description = table.Column(type: "varchar(500)", maxLength: 500, nullable: true, collation: "utf8mb4_unicode_ci"), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + Annotations = table.Column(type: "longtext", nullable: true, collation: "utf8mb4_unicode_ci"), + CreatedBy = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { @@ -754,21 +1018,74 @@ namespace ERPCore.Migrations principalTable: "users", principalColumn: "UserId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "purchase_invoices", + columns: table => new + { + PurchaseInvoiceId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DocNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: false, collation: "utf8mb4_unicode_ci"), + VendorInvoiceNo = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"), + VendorInvoiceDate = table.Column(type: "datetime(6)", nullable: false), + VendorId = table.Column(type: "int", nullable: false), + BranchId = table.Column(type: "int", nullable: false), + VendorSnapshotName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + VendorSnapshotTaxNo = table.Column(type: "varchar(50)", maxLength: 50, nullable: true, collation: "utf8mb4_unicode_ci"), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Draft", collation: "utf8mb4_unicode_ci"), + Subtotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + VatTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + GrandTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + PaidAmount = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + BalanceAmount = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + GlJournalNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: true, collation: "utf8mb4_unicode_ci"), + GlPostedAt = table.Column(type: "datetime(6)", nullable: true), + CreatedBy = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_purchase_invoices", x => x.PurchaseInvoiceId); + table.ForeignKey( + name: "FK_purchase_invoices_hr_branches_BranchId", + column: x => x.BranchId, + principalTable: "hr_branches", + principalColumn: "BranchId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_purchase_invoices_users_CreatedBy", + column: x => x.CreatedBy, + principalTable: "users", + principalColumn: "UserId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_purchase_invoices_vendors_VendorId", + column: x => x.VendorId, + principalTable: "vendors", + principalColumn: "VendorId", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "purchase_returns", columns: table => new { - ReturnId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - DocNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: false), - VendorId = table.Column(type: "integer", nullable: false), - WarehouseId = table.Column(type: "integer", nullable: false), - ReasonCodeId = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - CreatedBy = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) + ReturnId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DocNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: false, collation: "utf8mb4_unicode_ci"), + VendorId = table.Column(type: "int", nullable: false), + WarehouseId = table.Column(type: "int", nullable: false), + ReasonCodeId = table.Column(type: "int", nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + CreatedBy = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + GlJournalNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: true, collation: "utf8mb4_unicode_ci"), + GlPostedAt = table.Column(type: "datetime(6)", nullable: true) }, constraints: table => { @@ -797,47 +1114,107 @@ namespace ERPCore.Migrations principalTable: "warehouses", principalColumn: "WarehouseId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "requisitions", columns: table => new { - RequisitionId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - DocNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: false), - RequestedBy = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) + RequisitionId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DocNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: false, collation: "utf8mb4_unicode_ci"), + RequestedBy = table.Column(type: "int", nullable: false), + BranchId = table.Column(type: "int", nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_requisitions", x => x.RequisitionId); + table.ForeignKey( + name: "FK_requisitions_hr_branches_BranchId", + column: x => x.BranchId, + principalTable: "hr_branches", + principalColumn: "BranchId", + onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_requisitions_users_RequestedBy", column: x => x.RequestedBy, principalTable: "users", principalColumn: "UserId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "sales_day_ends", + columns: table => new + { + SalesDayEndId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DocNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: false, collation: "utf8mb4_unicode_ci"), + CashierUserId = table.Column(type: "int", nullable: false), + BusinessDate = table.Column(type: "date", nullable: false), + SlipCount = table.Column(type: "int", nullable: false), + BundleCount = table.Column(type: "int", nullable: false, defaultValue: 0), + Subtotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + DiscountTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + TaxTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + GrandTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + PaidTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + BalanceTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + CostOfGoodsSold = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + GlJournalNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: true, collation: "utf8mb4_unicode_ci"), + GlPostedAt = table.Column(type: "datetime(6)", nullable: true), + ClosedBy = table.Column(type: "int", nullable: false), + ClosedAt = table.Column(type: "datetime(6)", nullable: false), + RowVersion = table.Column(type: "int unsigned", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_sales_day_ends", x => x.SalesDayEndId); + table.ForeignKey( + name: "FK_sales_day_ends_users_CashierUserId", + column: x => x.CashierUserId, + principalTable: "users", + principalColumn: "UserId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_sales_day_ends_users_ClosedBy", + column: x => x.ClosedBy, + principalTable: "users", + principalColumn: "UserId", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "stock_adjustments", columns: table => new { - AdjustmentId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - DocNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: false), - WarehouseId = table.Column(type: "integer", nullable: false), - ReasonCodeId = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - CreatedBy = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + AdjustmentId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DocNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: false, collation: "utf8mb4_unicode_ci"), + WarehouseId = table.Column(type: "int", nullable: false), + ReasonCodeId = table.Column(type: "int", nullable: false), + BranchId = table.Column(type: "int", nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + CreatedBy = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + RowVersion = table.Column(type: "int unsigned", nullable: false), + GlJournalNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: true, collation: "utf8mb4_unicode_ci"), + GlPostedAt = table.Column(type: "datetime(6)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_stock_adjustments", x => x.AdjustmentId); + table.ForeignKey( + name: "FK_stock_adjustments_hr_branches_BranchId", + column: x => x.BranchId, + principalTable: "hr_branches", + principalColumn: "BranchId", + onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_stock_adjustments_reason_codes_ReasonCodeId", column: x => x.ReasonCodeId, @@ -856,25 +1233,33 @@ namespace ERPCore.Migrations principalTable: "warehouses", principalColumn: "WarehouseId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "stock_counts", columns: table => new { - CountId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - DocNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: false), - WarehouseId = table.Column(type: "integer", nullable: false), - CountType = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - CreatedBy = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + CountId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DocNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: false, collation: "utf8mb4_unicode_ci"), + WarehouseId = table.Column(type: "int", nullable: false), + BranchId = table.Column(type: "int", nullable: false), + CountType = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + CreatedBy = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_stock_counts", x => x.CountId); + table.ForeignKey( + name: "FK_stock_counts_hr_branches_BranchId", + column: x => x.BranchId, + principalTable: "hr_branches", + principalColumn: "BranchId", + onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_stock_counts_users_CreatedBy", column: x => x.CreatedBy, @@ -887,25 +1272,33 @@ namespace ERPCore.Migrations principalTable: "warehouses", principalColumn: "WarehouseId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "stock_transfers", columns: table => new { - TransferId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - DocNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: false), - SrcWarehouseId = table.Column(type: "integer", nullable: false), - DestWarehouseId = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - CreatedBy = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + TransferId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DocNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: false, collation: "utf8mb4_unicode_ci"), + SrcWarehouseId = table.Column(type: "int", nullable: false), + DestWarehouseId = table.Column(type: "int", nullable: false), + BranchId = table.Column(type: "int", nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + CreatedBy = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_stock_transfers", x => x.TransferId); + table.ForeignKey( + name: "FK_stock_transfers_hr_branches_BranchId", + column: x => x.BranchId, + principalTable: "hr_branches", + principalColumn: "BranchId", + onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_stock_transfers_users_CreatedBy", column: x => x.CreatedBy, @@ -924,168 +1317,19 @@ namespace ERPCore.Migrations principalTable: "warehouses", principalColumn: "WarehouseId", onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "bundle_sales", - columns: table => new - { - BundleSaleId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - BundleNo = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - BundleDate = table.Column(type: "timestamp with time zone", nullable: false), - CustomerId = table.Column(type: "integer", nullable: false), - CustomerSnapshotName = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - WarehouseId = table.Column(type: "integer", nullable: false), - CashierUserId = table.Column(type: "integer", nullable: false), - BundleSaleTemplateId = table.Column(type: "integer", nullable: false), - BundleName = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - BundleCode = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Draft"), - ComponentSubtotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - BundlePrice = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - MarginAmount = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - DiscountTotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - TaxTotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - GrandTotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - ConcurrencyStamp = table.Column(type: "integer", nullable: false, defaultValue: 0) - }, - constraints: table => - { - table.PrimaryKey("PK_bundle_sales", x => x.BundleSaleId); - table.ForeignKey( - name: "FK_bundle_sales_bundle_sale_templates_BundleSaleTemplateId", - column: x => x.BundleSaleTemplateId, - principalTable: "bundle_sale_templates", - principalColumn: "BundleSaleTemplateId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_bundle_sales_customers_CustomerId", - column: x => x.CustomerId, - principalTable: "customers", - principalColumn: "CustomerId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_bundle_sales_users_CashierUserId", - column: x => x.CashierUserId, - principalTable: "users", - principalColumn: "UserId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_bundle_sales_warehouses_WarehouseId", - column: x => x.WarehouseId, - principalTable: "warehouses", - principalColumn: "WarehouseId", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "sales_invoices", - columns: table => new - { - SalesInvoiceId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - InvoiceNo = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - InvoiceDate = table.Column(type: "timestamp with time zone", nullable: false), - CustomerId = table.Column(type: "integer", nullable: false), - CustomerSnapshotName = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - CustomerSnapshotTaxNo = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), - WarehouseId = table.Column(type: "integer", nullable: false), - InvoiceType = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "B2C"), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Draft"), - Subtotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - DiscountTotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - TaxTotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - GrandTotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - RoundOff = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - NetPayable = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - PaidAmount = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - BalanceAmount = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - CreatedBy = table.Column(type: "integer", nullable: false), - CreatorUserId = table.Column(type: "integer", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_sales_invoices", x => x.SalesInvoiceId); - table.ForeignKey( - name: "FK_sales_invoices_customers_CustomerId", - column: x => x.CustomerId, - principalTable: "customers", - principalColumn: "CustomerId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_sales_invoices_users_CreatorUserId", - column: x => x.CreatorUserId, - principalTable: "users", - principalColumn: "UserId"); - table.ForeignKey( - name: "FK_sales_invoices_warehouses_WarehouseId", - column: x => x.WarehouseId, - principalTable: "warehouses", - principalColumn: "WarehouseId", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "sales_slips", - columns: table => new - { - SalesSlipId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - SlipNo = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - SlipDate = table.Column(type: "timestamp with time zone", nullable: false), - CustomerId = table.Column(type: "integer", nullable: false), - CustomerSnapshotName = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - WarehouseId = table.Column(type: "integer", nullable: false), - CashierUserId = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Draft"), - Subtotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - DiscountTotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - TaxTotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - GrandTotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - PaidAmount = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - BalanceAmount = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_sales_slips", x => x.SalesSlipId); - table.ForeignKey( - name: "FK_sales_slips_customers_CustomerId", - column: x => x.CustomerId, - principalTable: "customers", - principalColumn: "CustomerId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_sales_slips_users_CashierUserId", - column: x => x.CashierUserId, - principalTable: "users", - principalColumn: "UserId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_sales_slips_warehouses_WarehouseId", - column: x => x.WarehouseId, - principalTable: "warehouses", - principalColumn: "WarehouseId", - onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "batches", columns: table => new { - BatchId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ItemId = table.Column(type: "integer", nullable: false), - BatchNo = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - ExpiryDate = table.Column(type: "date", nullable: true) + BatchId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ItemId = table.Column(type: "int", nullable: false), + BatchNo = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"), + ExpiryDate = table.Column(type: "date", nullable: true), + Barcode = table.Column(type: "varchar(100)", maxLength: 100, nullable: true, collation: "utf8mb4_unicode_ci") }, constraints: table => { @@ -1096,27 +1340,28 @@ namespace ERPCore.Migrations principalTable: "items", principalColumn: "ItemId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "bundle_sale_template_lines", columns: table => new { - BundleSaleTemplateLineId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - BundleSaleTemplateId = table.Column(type: "integer", nullable: false), - ItemId = table.Column(type: "integer", nullable: false), - WarehouseId = table.Column(type: "integer", nullable: false), - Qty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - UnitPrice = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - IncludeInBundle = table.Column(type: "boolean", nullable: false), - SortOrder = table.Column(type: "integer", nullable: false, defaultValue: 0) + BundleSaleTemplateLineId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + BundleSaleTemplateId = table.Column(type: "int", nullable: false), + ItemId = table.Column(type: "int", nullable: false), + WarehouseId = table.Column(type: "int", nullable: false), + Qty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + UnitPrice = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + IncludeInBundle = table.Column(type: "tinyint(1)", nullable: false), + SortOrder = table.Column(type: "int", nullable: false, defaultValue: 0) }, constraints: table => { table.PrimaryKey("PK_bundle_sale_template_lines", x => x.BundleSaleTemplateLineId); table.ForeignKey( - name: "FK_bundle_sale_template_lines_bundle_sale_templates_BundleSale~", + name: "FK_bundle_sale_template_lines_bundle_sale_templates_BundleSaleT~", column: x => x.BundleSaleTemplateId, principalTable: "bundle_sale_templates", principalColumn: "BundleSaleTemplateId", @@ -1133,18 +1378,19 @@ namespace ERPCore.Migrations principalTable: "warehouses", principalColumn: "WarehouseId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "item_reorders", columns: table => new { - ReorderId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ItemId = table.Column(type: "integer", nullable: false), - WarehouseId = table.Column(type: "integer", nullable: false), - ReorderPoint = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - ReorderQty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false) + ReorderId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ItemId = table.Column(type: "int", nullable: false), + WarehouseId = table.Column(type: "int", nullable: false), + ReorderPoint = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + ReorderQty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false) }, constraints: table => { @@ -1161,17 +1407,19 @@ namespace ERPCore.Migrations principalTable: "warehouses", principalColumn: "WarehouseId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "serials", columns: table => new { - SerialId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ItemId = table.Column(type: "integer", nullable: false), - SerialNo = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false) + SerialId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ItemId = table.Column(type: "int", nullable: false), + SerialNo = table.Column(type: "varchar(100)", maxLength: 100, nullable: false, collation: "utf8mb4_unicode_ci"), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + Barcode = table.Column(type: "varchar(100)", maxLength: 100, nullable: true, collation: "utf8mb4_unicode_ci") }, constraints: table => { @@ -1182,14 +1430,122 @@ namespace ERPCore.Migrations principalTable: "items", principalColumn: "ItemId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "sales_invoices", + columns: table => new + { + SalesInvoiceId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + InvoiceNo = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"), + InvoiceDate = table.Column(type: "datetime(6)", nullable: false), + CustomerId = table.Column(type: "int", nullable: false), + CustomerSnapshotName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + CustomerSnapshotTaxNo = table.Column(type: "varchar(50)", maxLength: 50, nullable: true, collation: "utf8mb4_unicode_ci"), + WarehouseId = table.Column(type: "int", nullable: false), + BranchId = table.Column(type: "int", nullable: false), + InvoiceType = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "B2C", collation: "utf8mb4_unicode_ci"), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Draft", collation: "utf8mb4_unicode_ci"), + Subtotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + DiscountTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + TaxTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + GrandTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + RoundOff = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + NetPayable = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + PaidAmount = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + BalanceAmount = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + GlJournalNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: true, collation: "utf8mb4_unicode_ci"), + GlPostedAt = table.Column(type: "datetime(6)", nullable: true), + CreatedBy = table.Column(type: "int", nullable: false), + CreatorUserId = table.Column(type: "int", nullable: true), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_sales_invoices", x => x.SalesInvoiceId); + table.ForeignKey( + name: "FK_sales_invoices_customers_CustomerId", + column: x => x.CustomerId, + principalTable: "customers", + principalColumn: "CustomerId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_sales_invoices_hr_branches_BranchId", + column: x => x.BranchId, + principalTable: "hr_branches", + principalColumn: "BranchId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_sales_invoices_users_CreatorUserId", + column: x => x.CreatorUserId, + principalTable: "users", + principalColumn: "UserId"); + table.ForeignKey( + name: "FK_sales_invoices_warehouses_WarehouseId", + column: x => x.WarehouseId, + principalTable: "warehouses", + principalColumn: "WarehouseId", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "sales_returns", + columns: table => new + { + ReturnId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DocNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: false, collation: "utf8mb4_unicode_ci"), + CustomerId = table.Column(type: "int", nullable: false), + WarehouseId = table.Column(type: "int", nullable: false), + ReasonCodeId = table.Column(type: "int", nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + CreatedBy = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + GlJournalNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: true, collation: "utf8mb4_unicode_ci"), + GlPostedAt = table.Column(type: "datetime(6)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_sales_returns", x => x.ReturnId); + table.ForeignKey( + name: "FK_sales_returns_customers_CustomerId", + column: x => x.CustomerId, + principalTable: "customers", + principalColumn: "CustomerId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_sales_returns_reason_codes_ReasonCodeId", + column: x => x.ReasonCodeId, + principalTable: "reason_codes", + principalColumn: "ReasonCodeId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_sales_returns_users_CreatedBy", + column: x => x.CreatedBy, + principalTable: "users", + principalColumn: "UserId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_sales_returns_warehouses_WarehouseId", + column: x => x.WarehouseId, + principalTable: "warehouses", + principalColumn: "WarehouseId", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "role_permissions", columns: table => new { - RoleId = table.Column(type: "integer", nullable: false), - PermissionId = table.Column(type: "integer", nullable: false) + RoleId = table.Column(type: "int", nullable: false), + PermissionId = table.Column(type: "int", nullable: false), + Actions = table.Column(type: "int", nullable: false, defaultValue: 31) }, constraints: table => { @@ -1206,27 +1562,52 @@ namespace ERPCore.Migrations principalTable: "roles", principalColumn: "RoleId", onDelete: ReferentialAction.Cascade); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "notification_config_modules", + columns: table => new + { + NotificationConfigModuleId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + NotificationConfigId = table.Column(type: "int", nullable: false), + ModuleKey = table.Column(type: "varchar(100)", maxLength: 100, nullable: false, collation: "utf8mb4_unicode_ci"), + EmailEnabled = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false), + SmsEnabled = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false), + InAppEnabled = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false) + }, + constraints: table => + { + table.PrimaryKey("PK_notification_config_modules", x => x.NotificationConfigModuleId); + table.ForeignKey( + name: "FK_notification_config_modules_notification_config_Notification~", + column: x => x.NotificationConfigId, + principalTable: "notification_config", + principalColumn: "NotificationConfigId", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "production_runs", columns: table => new { - RunId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - DocNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: false), - TemplateId = table.Column(type: "integer", nullable: false), - WarehouseId = table.Column(type: "integer", nullable: false), - OutputBinId = table.Column(type: "integer", nullable: true), - TargetQty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - ScaleFactor = table.Column(type: "numeric(18,6)", precision: 18, scale: 6, nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - ReworkCount = table.Column(type: "integer", nullable: false), - CancelReasonCodeId = table.Column(type: "integer", nullable: true), - CreatedBy = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - CompletedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + RunId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DocNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: false, collation: "utf8mb4_unicode_ci"), + TemplateId = table.Column(type: "int", nullable: false), + WarehouseId = table.Column(type: "int", nullable: false), + OutputBinId = table.Column(type: "int", nullable: true), + TargetQty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + ScaleFactor = table.Column(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + ReworkCount = table.Column(type: "int", nullable: false), + CancelReasonCodeId = table.Column(type: "int", nullable: true), + CreatedBy = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + CompletedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { @@ -1261,21 +1642,22 @@ namespace ERPCore.Migrations principalTable: "warehouses", principalColumn: "WarehouseId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "template_stages", columns: table => new { - StageId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - TemplateId = table.Column(type: "integer", nullable: false), - Name = table.Column(type: "character varying(150)", maxLength: 150, nullable: false), - RoleLabel = table.Column(type: "character varying(60)", maxLength: 60, nullable: true), - EstimatedMinutes = table.Column(type: "integer", nullable: false), - PosX = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - PosY = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - FieldDefs = table.Column(type: "jsonb", nullable: false) + StageId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + TemplateId = table.Column(type: "int", nullable: false), + Name = table.Column(type: "varchar(150)", maxLength: 150, nullable: false, collation: "utf8mb4_unicode_ci"), + RoleLabel = table.Column(type: "varchar(60)", maxLength: 60, nullable: true, collation: "utf8mb4_unicode_ci"), + EstimatedMinutes = table.Column(type: "int", nullable: false), + PosX = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + PosY = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + FieldDefs = table.Column(type: "longtext", nullable: false, collation: "utf8mb4_unicode_ci") }, constraints: table => { @@ -1286,33 +1668,83 @@ namespace ERPCore.Migrations principalTable: "production_templates", principalColumn: "TemplateId", onDelete: ReferentialAction.Cascade); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "purchase_invoice_payments", + columns: table => new + { + PurchaseInvoicePaymentId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + PurchaseInvoiceId = table.Column(type: "int", nullable: false), + Amount = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + PaymentDate = table.Column(type: "datetime(6)", nullable: false), + GlBankAccountId = table.Column(type: "bigint", nullable: false), + BankAccountName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + Reference = table.Column(type: "varchar(100)", maxLength: 100, nullable: true, collation: "utf8mb4_unicode_ci"), + GlJournalNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: true, collation: "utf8mb4_unicode_ci"), + CreatedBy = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_purchase_invoice_payments", x => x.PurchaseInvoicePaymentId); + table.ForeignKey( + name: "FK_purchase_invoice_payments_purchase_invoices_PurchaseInvoiceId", + column: x => x.PurchaseInvoiceId, + principalTable: "purchase_invoices", + principalColumn: "PurchaseInvoiceId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_purchase_invoice_payments_users_CreatedBy", + column: x => x.CreatedBy, + principalTable: "users", + principalColumn: "UserId", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "purchase_orders", columns: table => new { - PoId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - DocNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: false), - VendorId = table.Column(type: "integer", nullable: false), - RequisitionId = table.Column(type: "integer", nullable: true), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - ApprovalRequired = table.Column(type: "boolean", nullable: false), - CreatedBy = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + PoId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DocNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: false, collation: "utf8mb4_unicode_ci"), + VendorId = table.Column(type: "int", nullable: false), + BranchId = table.Column(type: "int", nullable: false), + RequisitionId = table.Column(type: "int", nullable: true), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + ApprovalRequired = table.Column(type: "tinyint(1)", nullable: false), + CreatedBy = table.Column(type: "int", nullable: false), + ApprovedBy = table.Column(type: "int", nullable: true), + ApproverUserId = table.Column(type: "int", nullable: true), + ApprovedAt = table.Column(type: "datetime(6)", nullable: true), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_purchase_orders", x => x.PoId); + table.ForeignKey( + name: "FK_purchase_orders_hr_branches_BranchId", + column: x => x.BranchId, + principalTable: "hr_branches", + principalColumn: "BranchId", + onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_purchase_orders_requisitions_RequisitionId", column: x => x.RequisitionId, principalTable: "requisitions", principalColumn: "RequisitionId", onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_purchase_orders_users_ApproverUserId", + column: x => x.ApproverUserId, + principalTable: "users", + principalColumn: "UserId"); table.ForeignKey( name: "FK_purchase_orders_users_CreatedBy", column: x => x.CreatedBy, @@ -1325,17 +1757,18 @@ namespace ERPCore.Migrations principalTable: "vendors", principalColumn: "VendorId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "requisition_lines", columns: table => new { - ReqLineId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - RequisitionId = table.Column(type: "integer", nullable: false), - ItemId = table.Column(type: "integer", nullable: false), - Qty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), + ReqLineId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + RequisitionId = table.Column(type: "int", nullable: false), + ItemId = table.Column(type: "int", nullable: false), + Qty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), RequiredBy = table.Column(type: "date", nullable: true) }, constraints: table => @@ -1353,216 +1786,168 @@ namespace ERPCore.Migrations principalTable: "requisitions", principalColumn: "RequisitionId", onDelete: ReferentialAction.Cascade); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "rfqs", columns: table => new { - RfqId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - DocNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: false), - RequisitionId = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) + RfqId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DocNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: false, collation: "utf8mb4_unicode_ci"), + RequisitionId = table.Column(type: "int", nullable: false), + BranchId = table.Column(type: "int", nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_rfqs", x => x.RfqId); + table.ForeignKey( + name: "FK_rfqs_hr_branches_BranchId", + column: x => x.BranchId, + principalTable: "hr_branches", + principalColumn: "BranchId", + onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_rfqs_requisitions_RequisitionId", column: x => x.RequisitionId, principalTable: "requisitions", principalColumn: "RequisitionId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( - name: "stock_count_lines", + name: "bundle_sales", columns: table => new { - CountLineId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - CountId = table.Column(type: "integer", nullable: false), - ItemId = table.Column(type: "integer", nullable: false), - BinId = table.Column(type: "integer", nullable: true), - SystemQty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - CountedQty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: true), - Variance = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: true) + BundleSaleId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + BundleNo = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"), + BundleDate = table.Column(type: "datetime(6)", nullable: false), + CustomerId = table.Column(type: "int", nullable: false), + CustomerSnapshotName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + WarehouseId = table.Column(type: "int", nullable: false), + CashierUserId = table.Column(type: "int", nullable: false), + BundleSaleTemplateId = table.Column(type: "int", nullable: false), + BundleName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + BundleCode = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Draft", collation: "utf8mb4_unicode_ci"), + ComponentSubtotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + BundlePrice = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + MarginAmount = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + DiscountTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + TaxTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + GrandTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false), + DayEndId = table.Column(type: "int", nullable: true) }, constraints: table => { - table.PrimaryKey("PK_stock_count_lines", x => x.CountLineId); + table.PrimaryKey("PK_bundle_sales", x => x.BundleSaleId); table.ForeignKey( - name: "FK_stock_count_lines_bins_BinId", - column: x => x.BinId, - principalTable: "bins", - principalColumn: "BinId", + name: "FK_bundle_sales_bundle_sale_templates_BundleSaleTemplateId", + column: x => x.BundleSaleTemplateId, + principalTable: "bundle_sale_templates", + principalColumn: "BundleSaleTemplateId", onDelete: ReferentialAction.Restrict); table.ForeignKey( - name: "FK_stock_count_lines_items_ItemId", - column: x => x.ItemId, - principalTable: "items", - principalColumn: "ItemId", + name: "FK_bundle_sales_customers_CustomerId", + column: x => x.CustomerId, + principalTable: "customers", + principalColumn: "CustomerId", onDelete: ReferentialAction.Restrict); table.ForeignKey( - name: "FK_stock_count_lines_stock_counts_CountId", - column: x => x.CountId, - principalTable: "stock_counts", - principalColumn: "CountId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "bundle_sale_lines", - columns: table => new - { - BundleSaleLineId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - BundleSaleId = table.Column(type: "integer", nullable: false), - ItemId = table.Column(type: "integer", nullable: false), - Description = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Qty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - WarehouseId = table.Column(type: "integer", nullable: false), - UnitPrice = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - LineTotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - IncludeInBundle = table.Column(type: "boolean", nullable: false, defaultValue: true), - IsComponent = table.Column(type: "boolean", nullable: false, defaultValue: true), - ParentLineId = table.Column(type: "integer", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_bundle_sale_lines", x => x.BundleSaleLineId); - table.ForeignKey( - name: "FK_bundle_sale_lines_bundle_sales_BundleSaleId", - column: x => x.BundleSaleId, - principalTable: "bundle_sales", - principalColumn: "BundleSaleId", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_bundle_sale_lines_items_ItemId", - column: x => x.ItemId, - principalTable: "items", - principalColumn: "ItemId", + name: "FK_bundle_sales_sales_day_ends_DayEndId", + column: x => x.DayEndId, + principalTable: "sales_day_ends", + principalColumn: "SalesDayEndId", onDelete: ReferentialAction.Restrict); table.ForeignKey( - name: "FK_bundle_sale_lines_warehouses_WarehouseId", + name: "FK_bundle_sales_users_CashierUserId", + column: x => x.CashierUserId, + principalTable: "users", + principalColumn: "UserId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_bundle_sales_warehouses_WarehouseId", column: x => x.WarehouseId, principalTable: "warehouses", principalColumn: "WarehouseId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( - name: "sales_invoice_lines", + name: "sales_slips", columns: table => new { - SalesInvoiceLineId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - SalesInvoiceId = table.Column(type: "integer", nullable: false), - ItemId = table.Column(type: "integer", nullable: false), - Description = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Qty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - FreeQty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - WarehouseId = table.Column(type: "integer", nullable: false), - UnitPrice = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - BaseCost = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - PriceSource = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - DiscountMode = table.Column(type: "integer", nullable: false), - DiscountPct = table.Column(type: "numeric(9,4)", precision: 9, scale: 4, nullable: false), - DiscountAmount = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - NetUnitPrice = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - LineTotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - TaxPct = table.Column(type: "numeric(9,4)", precision: 9, scale: 4, nullable: false), - TaxAmount = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - IsFreeIssue = table.Column(type: "boolean", nullable: false), - ParentLineId = table.Column(type: "integer", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + SalesSlipId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + SlipNo = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"), + SlipDate = table.Column(type: "datetime(6)", nullable: false), + CustomerId = table.Column(type: "int", nullable: false), + CustomerSnapshotName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + WarehouseId = table.Column(type: "int", nullable: false), + CashierUserId = table.Column(type: "int", nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Draft", collation: "utf8mb4_unicode_ci"), + Subtotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + DiscountTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + TaxTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + GrandTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + PaidAmount = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + BalanceAmount = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + DayEndId = table.Column(type: "int", nullable: true), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { - table.PrimaryKey("PK_sales_invoice_lines", x => x.SalesInvoiceLineId); + table.PrimaryKey("PK_sales_slips", x => x.SalesSlipId); table.ForeignKey( - name: "FK_sales_invoice_lines_items_ItemId", - column: x => x.ItemId, - principalTable: "items", - principalColumn: "ItemId", + name: "FK_sales_slips_customers_CustomerId", + column: x => x.CustomerId, + principalTable: "customers", + principalColumn: "CustomerId", onDelete: ReferentialAction.Restrict); table.ForeignKey( - name: "FK_sales_invoice_lines_sales_invoices_SalesInvoiceId", - column: x => x.SalesInvoiceId, - principalTable: "sales_invoices", - principalColumn: "SalesInvoiceId", - onDelete: ReferentialAction.Cascade); + name: "FK_sales_slips_sales_day_ends_DayEndId", + column: x => x.DayEndId, + principalTable: "sales_day_ends", + principalColumn: "SalesDayEndId", + onDelete: ReferentialAction.Restrict); table.ForeignKey( - name: "FK_sales_invoice_lines_warehouses_WarehouseId", + name: "FK_sales_slips_users_CashierUserId", + column: x => x.CashierUserId, + principalTable: "users", + principalColumn: "UserId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_sales_slips_warehouses_WarehouseId", column: x => x.WarehouseId, principalTable: "warehouses", principalColumn: "WarehouseId", onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "sales_slip_lines", - columns: table => new - { - SalesSlipLineId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - SalesSlipId = table.Column(type: "integer", nullable: false), - ItemId = table.Column(type: "integer", nullable: false), - Description = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Qty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - FreeQty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - WarehouseId = table.Column(type: "integer", nullable: false), - UnitPrice = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - BaseCost = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - PriceSource = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - DiscountMode = table.Column(type: "integer", nullable: false), - DiscountPct = table.Column(type: "numeric(9,4)", precision: 9, scale: 4, nullable: false), - DiscountAmount = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - NetUnitPrice = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - LineTotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - TaxPct = table.Column(type: "numeric(9,4)", precision: 9, scale: 4, nullable: false), - TaxAmount = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - IsFreeIssue = table.Column(type: "boolean", nullable: false), - ParentLineId = table.Column(type: "integer", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_sales_slip_lines", x => x.SalesSlipLineId); - table.ForeignKey( - name: "FK_sales_slip_lines_items_ItemId", - column: x => x.ItemId, - principalTable: "items", - principalColumn: "ItemId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_sales_slip_lines_sales_slips_SalesSlipId", - column: x => x.SalesSlipId, - principalTable: "sales_slips", - principalColumn: "SalesSlipId", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_sales_slip_lines_warehouses_WarehouseId", - column: x => x.WarehouseId, - principalTable: "warehouses", - principalColumn: "WarehouseId", - onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "stock_adjustment_lines", columns: table => new { - AdjLineId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - AdjustmentId = table.Column(type: "integer", nullable: false), - ItemId = table.Column(type: "integer", nullable: false), - BinId = table.Column(type: "integer", nullable: true), - BatchId = table.Column(type: "integer", nullable: true), - SerialId = table.Column(type: "integer", nullable: true), - QtyDelta = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false) + AdjLineId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + AdjustmentId = table.Column(type: "int", nullable: false), + ItemId = table.Column(type: "int", nullable: false), + BinId = table.Column(type: "int", nullable: true), + BatchId = table.Column(type: "int", nullable: true), + SerialId = table.Column(type: "int", nullable: true), + QtyDelta = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false) }, constraints: table => { @@ -1597,28 +1982,80 @@ namespace ERPCore.Migrations principalTable: "stock_adjustments", principalColumn: "AdjustmentId", onDelete: ReferentialAction.Cascade); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "stock_count_lines", + columns: table => new + { + CountLineId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CountId = table.Column(type: "int", nullable: false), + ItemId = table.Column(type: "int", nullable: false), + BinId = table.Column(type: "int", nullable: true), + BatchId = table.Column(type: "int", nullable: true), + SerialId = table.Column(type: "int", nullable: true), + SystemQty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + CountedQty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true), + Variance = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_stock_count_lines", x => x.CountLineId); + table.ForeignKey( + name: "FK_stock_count_lines_batches_BatchId", + column: x => x.BatchId, + principalTable: "batches", + principalColumn: "BatchId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_stock_count_lines_bins_BinId", + column: x => x.BinId, + principalTable: "bins", + principalColumn: "BinId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_stock_count_lines_items_ItemId", + column: x => x.ItemId, + principalTable: "items", + principalColumn: "ItemId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_stock_count_lines_serials_SerialId", + column: x => x.SerialId, + principalTable: "serials", + principalColumn: "SerialId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_stock_count_lines_stock_counts_CountId", + column: x => x.CountId, + principalTable: "stock_counts", + principalColumn: "CountId", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "stock_ledger", columns: table => new { - LedgerId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ItemId = table.Column(type: "integer", nullable: false), - WarehouseId = table.Column(type: "integer", nullable: false), - BinId = table.Column(type: "integer", nullable: true), - BatchId = table.Column(type: "integer", nullable: true), - SerialId = table.Column(type: "integer", nullable: true), - UserId = table.Column(type: "integer", nullable: false), - Direction = table.Column(type: "character varying(5)", maxLength: 5, nullable: false), - QtyBase = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - UnitCost = table.Column(type: "numeric(18,6)", precision: 18, scale: 6, nullable: false), - Value = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - RunningBalance = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - SourceDocType = table.Column(type: "character varying(10)", maxLength: 10, nullable: false), - SourceDocId = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) + LedgerId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ItemId = table.Column(type: "int", nullable: false), + WarehouseId = table.Column(type: "int", nullable: false), + BinId = table.Column(type: "int", nullable: true), + BatchId = table.Column(type: "int", nullable: true), + SerialId = table.Column(type: "int", nullable: true), + UserId = table.Column(type: "int", nullable: false), + Direction = table.Column(type: "varchar(5)", maxLength: 5, nullable: false, collation: "utf8mb4_unicode_ci"), + QtyBase = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + UnitCost = table.Column(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false), + Value = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + RunningBalance = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + SourceDocType = table.Column(type: "varchar(10)", maxLength: 10, nullable: false, collation: "utf8mb4_unicode_ci"), + SourceDocId = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false) }, constraints: table => { @@ -1659,23 +2096,24 @@ namespace ERPCore.Migrations principalTable: "warehouses", principalColumn: "WarehouseId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "stock_transfer_lines", columns: table => new { - TransferLineId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - TransferId = table.Column(type: "integer", nullable: false), - ItemId = table.Column(type: "integer", nullable: false), - SrcBinId = table.Column(type: "integer", nullable: true), - DestBinId = table.Column(type: "integer", nullable: true), - BatchId = table.Column(type: "integer", nullable: true), - SerialId = table.Column(type: "integer", nullable: true), - Qty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - UnitCost = table.Column(type: "numeric(18,6)", precision: 18, scale: 6, nullable: true), - QtyReceived = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false) + TransferLineId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + TransferId = table.Column(type: "int", nullable: false), + ItemId = table.Column(type: "int", nullable: false), + SrcBinId = table.Column(type: "int", nullable: true), + DestBinId = table.Column(type: "int", nullable: true), + BatchId = table.Column(type: "int", nullable: true), + SerialId = table.Column(type: "int", nullable: true), + Qty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + UnitCost = table.Column(type: "decimal(18,6)", precision: 18, scale: 6, nullable: true), + QtyReceived = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false) }, constraints: table => { @@ -1716,27 +2154,112 @@ namespace ERPCore.Migrations principalTable: "stock_transfers", principalColumn: "TransferId", onDelete: ReferentialAction.Cascade); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "sales_invoice_lines", + columns: table => new + { + SalesInvoiceLineId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + SalesInvoiceId = table.Column(type: "int", nullable: false), + ItemId = table.Column(type: "int", nullable: false), + Description = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + Qty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + FreeQty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + WarehouseId = table.Column(type: "int", nullable: false), + UnitPrice = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + BaseCost = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + PriceSource = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"), + DiscountMode = table.Column(type: "int", nullable: false), + DiscountPct = table.Column(type: "decimal(9,4)", precision: 9, scale: 4, nullable: false), + DiscountAmount = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + NetUnitPrice = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + LineTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + TaxPct = table.Column(type: "decimal(9,4)", precision: 9, scale: 4, nullable: false), + TaxAmount = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + IsFreeIssue = table.Column(type: "tinyint(1)", nullable: false), + ParentLineId = table.Column(type: "int", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_sales_invoice_lines", x => x.SalesInvoiceLineId); + table.ForeignKey( + name: "FK_sales_invoice_lines_items_ItemId", + column: x => x.ItemId, + principalTable: "items", + principalColumn: "ItemId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_sales_invoice_lines_sales_invoices_SalesInvoiceId", + column: x => x.SalesInvoiceId, + principalTable: "sales_invoices", + principalColumn: "SalesInvoiceId", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_sales_invoice_lines_warehouses_WarehouseId", + column: x => x.WarehouseId, + principalTable: "warehouses", + principalColumn: "WarehouseId", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "sales_invoice_payments", + columns: table => new + { + SalesInvoicePaymentId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + SalesInvoiceId = table.Column(type: "int", nullable: false), + Amount = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + PaymentDate = table.Column(type: "datetime(6)", nullable: false), + GlBankAccountId = table.Column(type: "bigint", nullable: false), + BankAccountName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + Reference = table.Column(type: "varchar(100)", maxLength: 100, nullable: true, collation: "utf8mb4_unicode_ci"), + GlJournalNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: true, collation: "utf8mb4_unicode_ci"), + CreatedBy = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_sales_invoice_payments", x => x.SalesInvoicePaymentId); + table.ForeignKey( + name: "FK_sales_invoice_payments_sales_invoices_SalesInvoiceId", + column: x => x.SalesInvoiceId, + principalTable: "sales_invoices", + principalColumn: "SalesInvoiceId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_sales_invoice_payments_users_CreatedBy", + column: x => x.CreatedBy, + principalTable: "users", + principalColumn: "UserId", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "run_stages", columns: table => new { - RunStageId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - RunId = table.Column(type: "integer", nullable: false), - TemplateStageId = table.Column(type: "integer", nullable: true), - Name = table.Column(type: "character varying(150)", maxLength: 150, nullable: false), - RoleLabel = table.Column(type: "character varying(60)", maxLength: 60, nullable: true), - EstimatedMinutes = table.Column(type: "integer", nullable: false), - PosX = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - PosY = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - ActualStartAt = table.Column(type: "timestamp with time zone", nullable: true), - ActualEndAt = table.Column(type: "timestamp with time zone", nullable: true), - FieldDefs = table.Column(type: "jsonb", nullable: false), - FieldValues = table.Column(type: "jsonb", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + RunStageId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + RunId = table.Column(type: "int", nullable: false), + TemplateStageId = table.Column(type: "int", nullable: true), + Name = table.Column(type: "varchar(150)", maxLength: 150, nullable: false, collation: "utf8mb4_unicode_ci"), + RoleLabel = table.Column(type: "varchar(60)", maxLength: 60, nullable: true, collation: "utf8mb4_unicode_ci"), + EstimatedMinutes = table.Column(type: "int", nullable: false), + PosX = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + PosY = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + ActualStartAt = table.Column(type: "datetime(6)", nullable: true), + ActualEndAt = table.Column(type: "datetime(6)", nullable: true), + FieldDefs = table.Column(type: "longtext", nullable: false, collation: "utf8mb4_unicode_ci"), + FieldValues = table.Column(type: "longtext", nullable: true, collation: "utf8mb4_unicode_ci"), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { @@ -1753,17 +2276,18 @@ namespace ERPCore.Migrations principalTable: "template_stages", principalColumn: "StageId", onDelete: ReferentialAction.SetNull); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "stage_edges", columns: table => new { - EdgeId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - TemplateId = table.Column(type: "integer", nullable: false), - ParentStageId = table.Column(type: "integer", nullable: false), - ChildStageId = table.Column(type: "integer", nullable: false) + EdgeId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + TemplateId = table.Column(type: "int", nullable: false), + ParentStageId = table.Column(type: "int", nullable: false), + ChildStageId = table.Column(type: "int", nullable: false) }, constraints: table => { @@ -1786,19 +2310,20 @@ namespace ERPCore.Migrations principalTable: "template_stages", principalColumn: "StageId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "stage_outputs", columns: table => new { - OutputId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - StageId = table.Column(type: "integer", nullable: false), - ItemId = table.Column(type: "integer", nullable: true), - Name = table.Column(type: "character varying(150)", maxLength: 150, nullable: false), - UomId = table.Column(type: "integer", nullable: true), - QtyPerBatch = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false) + OutputId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + StageId = table.Column(type: "int", nullable: false), + ItemId = table.Column(type: "int", nullable: true), + Name = table.Column(type: "varchar(150)", maxLength: 150, nullable: false, collation: "utf8mb4_unicode_ci"), + UomId = table.Column(type: "int", nullable: true), + QtyPerBatch = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false) }, constraints: table => { @@ -1821,27 +2346,44 @@ namespace ERPCore.Migrations principalTable: "uoms", principalColumn: "UomId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "grns", columns: table => new { - GrnId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - DocNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: false), - PoId = table.Column(type: "integer", nullable: true), - VendorId = table.Column(type: "integer", nullable: false), - WarehouseId = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - CreatedBy = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - PostedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + GrnId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DocNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: false, collation: "utf8mb4_unicode_ci"), + PoId = table.Column(type: "int", nullable: true), + VendorId = table.Column(type: "int", nullable: false), + WarehouseId = table.Column(type: "int", nullable: false), + BranchId = table.Column(type: "int", nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + CreatedBy = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + PostedAt = table.Column(type: "datetime(6)", nullable: true), + GlJournalNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: true, collation: "utf8mb4_unicode_ci"), + GlPostedAt = table.Column(type: "datetime(6)", nullable: true), + PurchaseInvoiceId = table.Column(type: "int", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_grns", x => x.GrnId); + table.ForeignKey( + name: "FK_grns_hr_branches_BranchId", + column: x => x.BranchId, + principalTable: "hr_branches", + principalColumn: "BranchId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_grns_purchase_invoices_PurchaseInvoiceId", + column: x => x.PurchaseInvoiceId, + principalTable: "purchase_invoices", + principalColumn: "PurchaseInvoiceId", + onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_grns_purchase_orders_PoId", column: x => x.PoId, @@ -1866,21 +2408,22 @@ namespace ERPCore.Migrations principalTable: "warehouses", principalColumn: "WarehouseId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "po_lines", columns: table => new { - PoLineId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - PoId = table.Column(type: "integer", nullable: false), - ItemId = table.Column(type: "integer", nullable: false), - WarehouseId = table.Column(type: "integer", nullable: false), - Qty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - UnitPrice = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - Tax = table.Column(type: "numeric(9,4)", precision: 9, scale: 4, nullable: false), - QtyReceived = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false) + PoLineId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + PoId = table.Column(type: "int", nullable: false), + ItemId = table.Column(type: "int", nullable: false), + WarehouseId = table.Column(type: "int", nullable: false), + Qty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + UnitPrice = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + Tax = table.Column(type: "decimal(9,4)", precision: 9, scale: 4, nullable: false), + QtyReceived = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false) }, constraints: table => { @@ -1903,17 +2446,18 @@ namespace ERPCore.Migrations principalTable: "warehouses", principalColumn: "WarehouseId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "rfq_lines", columns: table => new { - RfqLineId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - RfqId = table.Column(type: "integer", nullable: false), - ItemId = table.Column(type: "integer", nullable: false), - Qty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false) + RfqLineId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + RfqId = table.Column(type: "int", nullable: false), + ItemId = table.Column(type: "int", nullable: false), + Qty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false) }, constraints: table => { @@ -1930,17 +2474,18 @@ namespace ERPCore.Migrations principalTable: "rfqs", principalColumn: "RfqId", onDelete: ReferentialAction.Cascade); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "vendor_quotations", columns: table => new { - QuotationId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - RfqId = table.Column(type: "integer", nullable: false), - VendorId = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) + QuotationId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + RfqId = table.Column(type: "int", nullable: false), + VendorId = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false) }, constraints: table => { @@ -1957,17 +2502,158 @@ namespace ERPCore.Migrations principalTable: "vendors", principalColumn: "VendorId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "bundle_sale_lines", + columns: table => new + { + BundleSaleLineId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + BundleSaleId = table.Column(type: "int", nullable: false), + ItemId = table.Column(type: "int", nullable: false), + Description = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + Qty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + WarehouseId = table.Column(type: "int", nullable: false), + UnitPrice = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + LineTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + IncludeInBundle = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), + IsComponent = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), + ParentLineId = table.Column(type: "int", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_bundle_sale_lines", x => x.BundleSaleLineId); + table.ForeignKey( + name: "FK_bundle_sale_lines_bundle_sales_BundleSaleId", + column: x => x.BundleSaleId, + principalTable: "bundle_sales", + principalColumn: "BundleSaleId", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_bundle_sale_lines_items_ItemId", + column: x => x.ItemId, + principalTable: "items", + principalColumn: "ItemId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_bundle_sale_lines_warehouses_WarehouseId", + column: x => x.WarehouseId, + principalTable: "warehouses", + principalColumn: "WarehouseId", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "sales_slip_lines", + columns: table => new + { + SalesSlipLineId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + SalesSlipId = table.Column(type: "int", nullable: false), + ItemId = table.Column(type: "int", nullable: false), + Description = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + Qty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + FreeQty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + WarehouseId = table.Column(type: "int", nullable: false), + BatchId = table.Column(type: "int", nullable: true), + SerialId = table.Column(type: "int", nullable: true), + UnitPrice = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + BaseCost = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + PriceSource = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"), + DiscountMode = table.Column(type: "int", nullable: false), + DiscountPct = table.Column(type: "decimal(9,4)", precision: 9, scale: 4, nullable: false), + DiscountAmount = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + NetUnitPrice = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + LineTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + TaxPct = table.Column(type: "decimal(9,4)", precision: 9, scale: 4, nullable: false), + TaxAmount = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + IsFreeIssue = table.Column(type: "tinyint(1)", nullable: false), + ParentLineId = table.Column(type: "int", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_sales_slip_lines", x => x.SalesSlipLineId); + table.ForeignKey( + name: "FK_sales_slip_lines_batches_BatchId", + column: x => x.BatchId, + principalTable: "batches", + principalColumn: "BatchId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_sales_slip_lines_items_ItemId", + column: x => x.ItemId, + principalTable: "items", + principalColumn: "ItemId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_sales_slip_lines_sales_slips_SalesSlipId", + column: x => x.SalesSlipId, + principalTable: "sales_slips", + principalColumn: "SalesSlipId", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_sales_slip_lines_serials_SerialId", + column: x => x.SerialId, + principalTable: "serials", + principalColumn: "SerialId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_sales_slip_lines_warehouses_WarehouseId", + column: x => x.WarehouseId, + principalTable: "warehouses", + principalColumn: "WarehouseId", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "sales_return_lines", + columns: table => new + { + ReturnLineId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ReturnId = table.Column(type: "int", nullable: false), + SalesInvoiceLineId = table.Column(type: "int", nullable: true), + ItemId = table.Column(type: "int", nullable: false), + Qty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_sales_return_lines", x => x.ReturnLineId); + table.ForeignKey( + name: "FK_sales_return_lines_items_ItemId", + column: x => x.ItemId, + principalTable: "items", + principalColumn: "ItemId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_sales_return_lines_sales_invoice_lines_SalesInvoiceLineId", + column: x => x.SalesInvoiceLineId, + principalTable: "sales_invoice_lines", + principalColumn: "SalesInvoiceLineId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_sales_return_lines_sales_returns_ReturnId", + column: x => x.ReturnId, + principalTable: "sales_returns", + principalColumn: "ReturnId", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "run_edges", columns: table => new { - RunEdgeId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - RunId = table.Column(type: "integer", nullable: false), - ParentRunStageId = table.Column(type: "integer", nullable: false), - ChildRunStageId = table.Column(type: "integer", nullable: false) + RunEdgeId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + RunId = table.Column(type: "int", nullable: false), + ParentRunStageId = table.Column(type: "int", nullable: false), + ChildRunStageId = table.Column(type: "int", nullable: false) }, constraints: table => { @@ -1990,21 +2676,22 @@ namespace ERPCore.Migrations principalTable: "run_stages", principalColumn: "RunStageId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "run_stage_events", columns: table => new { - EventId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - RunId = table.Column(type: "integer", nullable: false), - RunStageId = table.Column(type: "integer", nullable: true), - EventType = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - Note = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), - Payload = table.Column(type: "jsonb", nullable: true), - UserId = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) + EventId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + RunId = table.Column(type: "int", nullable: false), + RunStageId = table.Column(type: "int", nullable: true), + EventType = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + Note = table.Column(type: "varchar(500)", maxLength: 500, nullable: true, collation: "utf8mb4_unicode_ci"), + Payload = table.Column(type: "longtext", nullable: true, collation: "utf8mb4_unicode_ci"), + UserId = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false) }, constraints: table => { @@ -2027,23 +2714,24 @@ namespace ERPCore.Migrations principalTable: "users", principalColumn: "UserId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "run_stage_outputs", columns: table => new { - RunOutputId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - RunStageId = table.Column(type: "integer", nullable: false), - ItemId = table.Column(type: "integer", nullable: true), - Name = table.Column(type: "character varying(150)", maxLength: 150, nullable: false), - UomId = table.Column(type: "integer", nullable: true), - PlannedQty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - ProducedQty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - ScrappedQty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - ScrapReasonCodeId = table.Column(type: "integer", nullable: true), - TransferredQty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false) + RunOutputId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + RunStageId = table.Column(type: "int", nullable: false), + ItemId = table.Column(type: "int", nullable: true), + Name = table.Column(type: "varchar(150)", maxLength: 150, nullable: false, collation: "utf8mb4_unicode_ci"), + UomId = table.Column(type: "int", nullable: true), + PlannedQty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + ProducedQty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + ScrappedQty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + ScrapReasonCodeId = table.Column(type: "int", nullable: true), + TransferredQty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false) }, constraints: table => { @@ -2072,20 +2760,21 @@ namespace ERPCore.Migrations principalTable: "uoms", principalColumn: "UomId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "stage_inputs", columns: table => new { - InputId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - StageId = table.Column(type: "integer", nullable: false), - Source = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - ItemId = table.Column(type: "integer", nullable: true), - FromOutputId = table.Column(type: "integer", nullable: true), - QtyUnit = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - QtyPerBatch = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false) + InputId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + StageId = table.Column(type: "int", nullable: false), + Source = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + ItemId = table.Column(type: "int", nullable: true), + FromOutputId = table.Column(type: "int", nullable: true), + QtyUnit = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + QtyPerBatch = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false) }, constraints: table => { @@ -2108,29 +2797,60 @@ namespace ERPCore.Migrations principalTable: "template_stages", principalColumn: "StageId", onDelete: ReferentialAction.Cascade); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "purchase_invoice_lines", + columns: table => new + { + PurchaseInvoiceLineId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + PurchaseInvoiceId = table.Column(type: "int", nullable: false), + GrnId = table.Column(type: "int", nullable: false), + Subtotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + VatTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + LineTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_purchase_invoice_lines", x => x.PurchaseInvoiceLineId); + table.ForeignKey( + name: "FK_purchase_invoice_lines_grns_GrnId", + column: x => x.GrnId, + principalTable: "grns", + principalColumn: "GrnId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_purchase_invoice_lines_purchase_invoices_PurchaseInvoiceId", + column: x => x.PurchaseInvoiceId, + principalTable: "purchase_invoices", + principalColumn: "PurchaseInvoiceId", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "grn_lines", columns: table => new { - GrnLineId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - GrnId = table.Column(type: "integer", nullable: false), - PoLineId = table.Column(type: "integer", nullable: true), - ItemId = table.Column(type: "integer", nullable: false), - BinId = table.Column(type: "integer", nullable: true), - BatchId = table.Column(type: "integer", nullable: true), - Qty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - UnitCost = table.Column(type: "numeric(18,6)", precision: 18, scale: 6, nullable: false), - PoUnitPrice = table.Column(type: "numeric(18,6)", precision: 18, scale: 6, nullable: true), - DiscountPct = table.Column(type: "numeric(9,4)", precision: 9, scale: 4, nullable: false), - NetUnitCost = table.Column(type: "numeric(18,6)", precision: 18, scale: 6, nullable: false), - VatPct = table.Column(type: "numeric(9,4)", precision: 9, scale: 4, nullable: false), - VatAmount = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - ReceivedValue = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - LineTotal = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - HoldStatus = table.Column(type: "character varying(20)", maxLength: 20, nullable: false) + GrnLineId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + GrnId = table.Column(type: "int", nullable: false), + PoLineId = table.Column(type: "int", nullable: true), + ItemId = table.Column(type: "int", nullable: false), + BinId = table.Column(type: "int", nullable: true), + BatchId = table.Column(type: "int", nullable: true), + Qty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + UnitCost = table.Column(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false), + PoUnitPrice = table.Column(type: "decimal(18,6)", precision: 18, scale: 6, nullable: true), + DiscountPct = table.Column(type: "decimal(9,4)", precision: 9, scale: 4, nullable: false), + NetUnitCost = table.Column(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false), + VatPct = table.Column(type: "decimal(9,4)", precision: 9, scale: 4, nullable: false), + VatAmount = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + ReceivedValue = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + LineTotal = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + HoldStatus = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci") }, constraints: table => { @@ -2165,18 +2885,19 @@ namespace ERPCore.Migrations principalTable: "po_lines", principalColumn: "PoLineId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "vendor_quotation_lines", columns: table => new { - QuotationLineId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - QuotationId = table.Column(type: "integer", nullable: false), - ItemId = table.Column(type: "integer", nullable: false), - UnitPrice = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - LeadDays = table.Column(type: "integer", nullable: false) + QuotationLineId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + QuotationId = table.Column(type: "int", nullable: false), + ItemId = table.Column(type: "int", nullable: false), + UnitPrice = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + LeadDays = table.Column(type: "int", nullable: false) }, constraints: table => { @@ -2193,25 +2914,26 @@ namespace ERPCore.Migrations principalTable: "vendor_quotations", principalColumn: "QuotationId", onDelete: ReferentialAction.Cascade); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "run_stage_inputs", columns: table => new { - RunInputId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - RunStageId = table.Column(type: "integer", nullable: false), - Source = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - ItemId = table.Column(type: "integer", nullable: true), - FromRunOutputId = table.Column(type: "integer", nullable: true), - QtyUnit = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - PlannedQty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - ConsumedQty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - ConsumedValue = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - DeliveredQty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - ReturnedQty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - ReturnedValue = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false) + RunInputId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + RunStageId = table.Column(type: "int", nullable: false), + Source = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + ItemId = table.Column(type: "int", nullable: true), + FromRunOutputId = table.Column(type: "int", nullable: true), + QtyUnit = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + PlannedQty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + ConsumedQty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + ConsumedValue = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + DeliveredQty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + ReturnedQty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + ReturnedValue = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false) }, constraints: table => { @@ -2234,18 +2956,41 @@ namespace ERPCore.Migrations principalTable: "run_stages", principalColumn: "RunStageId", onDelete: ReferentialAction.Cascade); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "grn_line_warranty_numbers", + columns: table => new + { + GrnLineWarrantyNumberId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + GrnLineId = table.Column(type: "int", nullable: false), + WarrantyNo = table.Column(type: "varchar(100)", maxLength: 100, nullable: false, collation: "utf8mb4_unicode_ci"), + WarrantyPeriodMonths = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_grn_line_warranty_numbers", x => x.GrnLineWarrantyNumberId); + table.ForeignKey( + name: "FK_grn_line_warranty_numbers_grn_lines_GrnLineId", + column: x => x.GrnLineId, + principalTable: "grn_lines", + principalColumn: "GrnLineId", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "purchase_return_lines", columns: table => new { - ReturnLineId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ReturnId = table.Column(type: "integer", nullable: false), - GrnLineId = table.Column(type: "integer", nullable: true), - ItemId = table.Column(type: "integer", nullable: false), - Qty = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false) + ReturnLineId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ReturnId = table.Column(type: "int", nullable: false), + GrnLineId = table.Column(type: "int", nullable: true), + ItemId = table.Column(type: "int", nullable: false), + Qty = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false) }, constraints: table => { @@ -2268,23 +3013,24 @@ namespace ERPCore.Migrations principalTable: "purchase_returns", principalColumn: "ReturnId", onDelete: ReferentialAction.Cascade); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "stock_layers", columns: table => new { - LayerId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ItemId = table.Column(type: "integer", nullable: false), - WarehouseId = table.Column(type: "integer", nullable: false), - BatchId = table.Column(type: "integer", nullable: true), - SerialId = table.Column(type: "integer", nullable: true), - GrnLineId = table.Column(type: "integer", nullable: true), - QtyReceived = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - QtyRemaining = table.Column(type: "numeric(18,4)", precision: 18, scale: 4, nullable: false), - UnitCost = table.Column(type: "numeric(18,6)", precision: 18, scale: 6, nullable: false), - ReceiptDate = table.Column(type: "timestamp with time zone", nullable: false) + LayerId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ItemId = table.Column(type: "int", nullable: false), + WarehouseId = table.Column(type: "int", nullable: false), + BatchId = table.Column(type: "int", nullable: true), + SerialId = table.Column(type: "int", nullable: true), + GrnLineId = table.Column(type: "int", nullable: true), + QtyReceived = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + QtyRemaining = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false), + UnitCost = table.Column(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false), + ReceiptDate = table.Column(type: "datetime(6)", nullable: false) }, constraints: table => { @@ -2319,38 +3065,39 @@ namespace ERPCore.Migrations principalTable: "warehouses", principalColumn: "WarehouseId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_attendance_records", columns: table => new { - AttendanceRecordId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - AttendanceUploadBatchId = table.Column(type: "integer", nullable: true), - EmployeeId = table.Column(type: "integer", nullable: false), - AttendanceDate = table.Column(type: "timestamp with time zone", nullable: false), - CheckIn = table.Column(type: "interval", nullable: true), - CheckOut = table.Column(type: "interval", nullable: true), - WorkShiftId = table.Column(type: "integer", nullable: false), - WorkingMinutes = table.Column(type: "integer", nullable: false), - LateMinutes = table.Column(type: "integer", nullable: false), - EarlyLeaveMinutes = table.Column(type: "integer", nullable: false), - OvertimeMinutes = table.Column(type: "integer", nullable: false), - AttendanceStatus = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - RowValidationStatus = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - DuplicateOfAttendanceRecordId = table.Column(type: "integer", nullable: true), - Notes = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), - IsManualOverride = table.Column(type: "boolean", nullable: false), - EditedBy = table.Column(type: "integer", nullable: true), - EditedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + AttendanceRecordId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + AttendanceUploadBatchId = table.Column(type: "int", nullable: true), + EmployeeId = table.Column(type: "int", nullable: false), + AttendanceDate = table.Column(type: "datetime(6)", nullable: false), + CheckIn = table.Column(type: "time(6)", nullable: true), + CheckOut = table.Column(type: "time(6)", nullable: true), + WorkShiftId = table.Column(type: "int", nullable: false), + WorkingMinutes = table.Column(type: "int", nullable: false), + LateMinutes = table.Column(type: "int", nullable: false), + EarlyLeaveMinutes = table.Column(type: "int", nullable: false), + OvertimeMinutes = table.Column(type: "int", nullable: false), + AttendanceStatus = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + RowValidationStatus = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + DuplicateOfAttendanceRecordId = table.Column(type: "int", nullable: true), + Notes = table.Column(type: "varchar(1000)", maxLength: 1000, nullable: true, collation: "utf8mb4_unicode_ci"), + IsManualOverride = table.Column(type: "tinyint(1)", nullable: false), + EditedBy = table.Column(type: "int", nullable: true), + EditedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { table.PrimaryKey("PK_hr_attendance_records", x => x.AttendanceRecordId); table.ForeignKey( - name: "FK_hr_attendance_records_hr_attendance_upload_batches_Attendan~", + name: "FK_hr_attendance_records_hr_attendance_upload_batches_Attendanc~", column: x => x.AttendanceUploadBatchId, principalTable: "hr_attendance_upload_batches", principalColumn: "AttendanceUploadBatchId", @@ -2361,23 +3108,24 @@ namespace ERPCore.Migrations principalTable: "hr_work_shifts", principalColumn: "WorkShiftId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_departments", columns: table => new { - DepartmentId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Code = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - ParentDepartmentId = table.Column(type: "integer", nullable: true), - HeadEmployeeId = table.Column(type: "integer", nullable: true), - BranchId = table.Column(type: "integer", nullable: true), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + DepartmentId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Code = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + ParentDepartmentId = table.Column(type: "int", nullable: true), + HeadEmployeeId = table.Column(type: "int", nullable: true), + BranchId = table.Column(type: "int", nullable: true), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { @@ -2394,50 +3142,51 @@ namespace ERPCore.Migrations principalTable: "hr_departments", principalColumn: "DepartmentId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_employees", columns: table => new { - EmployeeId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - EmployeeCode = table.Column(type: "character varying(30)", maxLength: 30, nullable: false), - FullName = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Nic = table.Column(type: "character varying(30)", maxLength: 30, nullable: true), - DateOfBirth = table.Column(type: "timestamp with time zone", nullable: true), - Gender = table.Column(type: "character varying(20)", maxLength: 20, nullable: true), - Nationality = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), - ProfilePhotoPath = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), - Email = table.Column(type: "character varying(320)", maxLength: 320, nullable: true), - PersonalMobile = table.Column(type: "character varying(30)", maxLength: 30, nullable: true), - AddressLine1 = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), - AddressLine2 = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), - City = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), - PostalCode = table.Column(type: "character varying(20)", maxLength: 20, nullable: true), - Country = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), - EmergencyContactName = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), - EmergencyContactRelationship = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), - EmergencyContactPhone = table.Column(type: "character varying(30)", maxLength: 30, nullable: true), - HireDate = table.Column(type: "timestamp with time zone", nullable: false), - ConfirmationDate = table.Column(type: "timestamp with time zone", nullable: true), - LastWorkingDate = table.Column(type: "timestamp with time zone", nullable: true), - DepartmentId = table.Column(type: "integer", nullable: false), - DesignationId = table.Column(type: "integer", nullable: false), - EmploymentTypeId = table.Column(type: "integer", nullable: false), - BranchId = table.Column(type: "integer", nullable: true), - WorkShiftId = table.Column(type: "integer", nullable: false), - ReportingManagerId = table.Column(type: "integer", nullable: true), - EpfNumber = table.Column(type: "character varying(30)", maxLength: 30, nullable: true), - EtfNumber = table.Column(type: "character varying(30)", maxLength: 30, nullable: true), - TaxIdentificationNumber = table.Column(type: "character varying(30)", maxLength: 30, nullable: true), - UserId = table.Column(type: "integer", nullable: true), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedBy = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedBy = table.Column(type: "integer", nullable: true), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + EmployeeId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + EmployeeCode = table.Column(type: "varchar(30)", maxLength: 30, nullable: false, collation: "utf8mb4_unicode_ci"), + FullName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + Nic = table.Column(type: "varchar(30)", maxLength: 30, nullable: true, collation: "utf8mb4_unicode_ci"), + DateOfBirth = table.Column(type: "datetime(6)", nullable: true), + Gender = table.Column(type: "varchar(20)", maxLength: 20, nullable: true, collation: "utf8mb4_unicode_ci"), + Nationality = table.Column(type: "varchar(100)", maxLength: 100, nullable: true, collation: "utf8mb4_unicode_ci"), + ProfilePhotoPath = table.Column(type: "varchar(500)", maxLength: 500, nullable: true, collation: "utf8mb4_unicode_ci"), + Email = table.Column(type: "varchar(320)", maxLength: 320, nullable: true, collation: "utf8mb4_unicode_ci"), + PersonalMobile = table.Column(type: "varchar(30)", maxLength: 30, nullable: true, collation: "utf8mb4_unicode_ci"), + AddressLine1 = table.Column(type: "varchar(200)", maxLength: 200, nullable: true, collation: "utf8mb4_unicode_ci"), + AddressLine2 = table.Column(type: "varchar(200)", maxLength: 200, nullable: true, collation: "utf8mb4_unicode_ci"), + City = table.Column(type: "varchar(100)", maxLength: 100, nullable: true, collation: "utf8mb4_unicode_ci"), + PostalCode = table.Column(type: "varchar(20)", maxLength: 20, nullable: true, collation: "utf8mb4_unicode_ci"), + Country = table.Column(type: "varchar(100)", maxLength: 100, nullable: true, collation: "utf8mb4_unicode_ci"), + EmergencyContactName = table.Column(type: "varchar(200)", maxLength: 200, nullable: true, collation: "utf8mb4_unicode_ci"), + EmergencyContactRelationship = table.Column(type: "varchar(100)", maxLength: 100, nullable: true, collation: "utf8mb4_unicode_ci"), + EmergencyContactPhone = table.Column(type: "varchar(30)", maxLength: 30, nullable: true, collation: "utf8mb4_unicode_ci"), + HireDate = table.Column(type: "datetime(6)", nullable: false), + ConfirmationDate = table.Column(type: "datetime(6)", nullable: true), + LastWorkingDate = table.Column(type: "datetime(6)", nullable: true), + DepartmentId = table.Column(type: "int", nullable: false), + DesignationId = table.Column(type: "int", nullable: false), + EmploymentTypeId = table.Column(type: "int", nullable: false), + BranchId = table.Column(type: "int", nullable: false), + WorkShiftId = table.Column(type: "int", nullable: false), + ReportingManagerId = table.Column(type: "int", nullable: true), + EpfNumber = table.Column(type: "varchar(30)", maxLength: 30, nullable: true, collation: "utf8mb4_unicode_ci"), + EtfNumber = table.Column(type: "varchar(30)", maxLength: 30, nullable: true, collation: "utf8mb4_unicode_ci"), + TaxIdentificationNumber = table.Column(type: "varchar(30)", maxLength: 30, nullable: true, collation: "utf8mb4_unicode_ci"), + UserId = table.Column(type: "int", nullable: true), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + CreatedBy = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedBy = table.Column(type: "int", nullable: true), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { @@ -2484,25 +3233,26 @@ namespace ERPCore.Migrations principalTable: "users", principalColumn: "UserId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_employee_bank_details", columns: table => new { - EmployeeBankDetailId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - EmployeeId = table.Column(type: "integer", nullable: false), - BankName = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - BranchName = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - AccountNumber = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - AccountHolderName = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - SwiftCode = table.Column(type: "character varying(20)", maxLength: 20, nullable: true), - IsPrimary = table.Column(type: "boolean", nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + EmployeeBankDetailId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + EmployeeId = table.Column(type: "int", nullable: false), + BankName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + BranchName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + AccountNumber = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"), + AccountHolderName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + SwiftCode = table.Column(type: "varchar(20)", maxLength: 20, nullable: true, collation: "utf8mb4_unicode_ci"), + IsPrimary = table.Column(type: "tinyint(1)", nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { @@ -2513,30 +3263,31 @@ namespace ERPCore.Migrations principalTable: "hr_employees", principalColumn: "EmployeeId", onDelete: ReferentialAction.Cascade); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_employee_documents", columns: table => new { - EmployeeDocumentId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - EmployeeId = table.Column(type: "integer", nullable: false), - HrDocumentTypeId = table.Column(type: "integer", nullable: false), - OriginalFileName = table.Column(type: "character varying(260)", maxLength: 260, nullable: false), - StoredFileName = table.Column(type: "character varying(260)", maxLength: 260, nullable: false), - RelativePath = table.Column(type: "character varying(500)", maxLength: 500, nullable: false), - ContentType = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + EmployeeDocumentId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + EmployeeId = table.Column(type: "int", nullable: false), + HrDocumentTypeId = table.Column(type: "int", nullable: false), + OriginalFileName = table.Column(type: "varchar(260)", maxLength: 260, nullable: false, collation: "utf8mb4_unicode_ci"), + StoredFileName = table.Column(type: "varchar(260)", maxLength: 260, nullable: false, collation: "utf8mb4_unicode_ci"), + RelativePath = table.Column(type: "varchar(500)", maxLength: 500, nullable: false, collation: "utf8mb4_unicode_ci"), + ContentType = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), SizeBytes = table.Column(type: "bigint", nullable: false), - IssueDate = table.Column(type: "timestamp with time zone", nullable: true), - ExpiryDate = table.Column(type: "timestamp with time zone", nullable: true), - Notes = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), - UploadedBy = table.Column(type: "integer", nullable: false), - UploadedAt = table.Column(type: "timestamp with time zone", nullable: false), - VerifiedBy = table.Column(type: "integer", nullable: true), - VerifiedAt = table.Column(type: "timestamp with time zone", nullable: true), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + IssueDate = table.Column(type: "datetime(6)", nullable: true), + ExpiryDate = table.Column(type: "datetime(6)", nullable: true), + Notes = table.Column(type: "varchar(1000)", maxLength: 1000, nullable: true, collation: "utf8mb4_unicode_ci"), + UploadedBy = table.Column(type: "int", nullable: false), + UploadedAt = table.Column(type: "datetime(6)", nullable: false), + VerifiedBy = table.Column(type: "int", nullable: true), + VerifiedAt = table.Column(type: "datetime(6)", nullable: true), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { @@ -2553,30 +3304,31 @@ namespace ERPCore.Migrations principalTable: "hr_employees", principalColumn: "EmployeeId", onDelete: ReferentialAction.Cascade); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_employee_loans", columns: table => new { - EmployeeLoanId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - DocNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: false), - EmployeeId = table.Column(type: "integer", nullable: false), - LoanKind = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - PrincipalAmount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - InterestRate = table.Column(type: "numeric(6,4)", precision: 6, scale: 4, nullable: false), - InstallmentAmount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - NumberOfInstallments = table.Column(type: "integer", nullable: false), - StartYear = table.Column(type: "integer", nullable: false), - StartMonth = table.Column(type: "integer", nullable: false), - OutstandingBalance = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - ApprovedBy = table.Column(type: "integer", nullable: false), - ApprovedAt = table.Column(type: "timestamp with time zone", nullable: false), - CreatedBy = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + EmployeeLoanId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DocNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: false, collation: "utf8mb4_unicode_ci"), + EmployeeId = table.Column(type: "int", nullable: false), + LoanKind = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + PrincipalAmount = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + InterestRate = table.Column(type: "decimal(6,4)", precision: 6, scale: 4, nullable: false), + InstallmentAmount = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + NumberOfInstallments = table.Column(type: "int", nullable: false), + StartYear = table.Column(type: "int", nullable: false), + StartMonth = table.Column(type: "int", nullable: false), + OutstandingBalance = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + ApprovedBy = table.Column(type: "int", nullable: false), + ApprovedAt = table.Column(type: "datetime(6)", nullable: false), + CreatedBy = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { @@ -2587,25 +3339,26 @@ namespace ERPCore.Migrations principalTable: "hr_employees", principalColumn: "EmployeeId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_employee_salary_structures", columns: table => new { - EmployeeSalaryStructureId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - EmployeeId = table.Column(type: "integer", nullable: false), - EffectiveFrom = table.Column(type: "timestamp with time zone", nullable: false), - EffectiveTo = table.Column(type: "timestamp with time zone", nullable: true), - BasicSalary = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - Currency = table.Column(type: "character varying(3)", maxLength: 3, nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - ApprovedBy = table.Column(type: "integer", nullable: false), - ApprovedAt = table.Column(type: "timestamp with time zone", nullable: false), - CreatedBy = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + EmployeeSalaryStructureId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + EmployeeId = table.Column(type: "int", nullable: false), + EffectiveFrom = table.Column(type: "datetime(6)", nullable: false), + EffectiveTo = table.Column(type: "datetime(6)", nullable: true), + BasicSalary = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + Currency = table.Column(type: "varchar(3)", maxLength: 3, nullable: false, collation: "utf8mb4_unicode_ci"), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + ApprovedBy = table.Column(type: "int", nullable: false), + ApprovedAt = table.Column(type: "datetime(6)", nullable: false), + CreatedBy = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { @@ -2616,23 +3369,24 @@ namespace ERPCore.Migrations principalTable: "hr_employees", principalColumn: "EmployeeId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_leave_balances", columns: table => new { - LeaveBalanceId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - EmployeeId = table.Column(type: "integer", nullable: false), - LeaveTypeId = table.Column(type: "integer", nullable: false), - Year = table.Column(type: "integer", nullable: false), - EntitledDays = table.Column(type: "numeric(6,2)", precision: 6, scale: 2, nullable: false), - TakenDays = table.Column(type: "numeric(6,2)", precision: 6, scale: 2, nullable: false), - CarriedForwardDays = table.Column(type: "numeric(6,2)", precision: 6, scale: 2, nullable: false), - AdjustmentDays = table.Column(type: "numeric(6,2)", precision: 6, scale: 2, nullable: false), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true) + LeaveBalanceId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + EmployeeId = table.Column(type: "int", nullable: false), + LeaveTypeId = table.Column(type: "int", nullable: false), + Year = table.Column(type: "int", nullable: false), + EntitledDays = table.Column(type: "decimal(6,2)", precision: 6, scale: 2, nullable: false), + TakenDays = table.Column(type: "decimal(6,2)", precision: 6, scale: 2, nullable: false), + CarriedForwardDays = table.Column(type: "decimal(6,2)", precision: 6, scale: 2, nullable: false), + AdjustmentDays = table.Column(type: "decimal(6,2)", precision: 6, scale: 2, nullable: false), + RowVersion = table.Column(type: "int unsigned", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true) }, constraints: table => { @@ -2649,28 +3403,29 @@ namespace ERPCore.Migrations principalTable: "hr_leave_types", principalColumn: "LeaveTypeId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_leave_requests", columns: table => new { - LeaveRequestId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - DocNo = table.Column(type: "character varying(30)", maxLength: 30, nullable: false), - EmployeeId = table.Column(type: "integer", nullable: false), - LeaveTypeId = table.Column(type: "integer", nullable: false), - StartDate = table.Column(type: "timestamp with time zone", nullable: false), - EndDate = table.Column(type: "timestamp with time zone", nullable: false), - DaysCount = table.Column(type: "numeric(6,2)", precision: 6, scale: 2, nullable: false), - Reason = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - ApprovedBy = table.Column(type: "integer", nullable: true), - ApprovedAt = table.Column(type: "timestamp with time zone", nullable: true), - RejectionReason = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), - CreatedBy = table.Column(type: "integer", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + LeaveRequestId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DocNo = table.Column(type: "varchar(30)", maxLength: 30, nullable: false, collation: "utf8mb4_unicode_ci"), + EmployeeId = table.Column(type: "int", nullable: false), + LeaveTypeId = table.Column(type: "int", nullable: false), + StartDate = table.Column(type: "datetime(6)", nullable: false), + EndDate = table.Column(type: "datetime(6)", nullable: false), + DaysCount = table.Column(type: "decimal(6,2)", precision: 6, scale: 2, nullable: false), + Reason = table.Column(type: "varchar(1000)", maxLength: 1000, nullable: true, collation: "utf8mb4_unicode_ci"), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + ApprovedBy = table.Column(type: "int", nullable: true), + ApprovedAt = table.Column(type: "datetime(6)", nullable: true), + RejectionReason = table.Column(type: "varchar(1000)", maxLength: 1000, nullable: true, collation: "utf8mb4_unicode_ci"), + CreatedBy = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { @@ -2687,36 +3442,37 @@ namespace ERPCore.Migrations principalTable: "hr_leave_types", principalColumn: "LeaveTypeId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_payroll_lines", columns: table => new { - PayrollLineId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - PayrollRunId = table.Column(type: "integer", nullable: false), - EmployeeId = table.Column(type: "integer", nullable: false), - BasicSalary = table.Column(type: "numeric(18,2)", nullable: false), - TotalAllowances = table.Column(type: "numeric(18,2)", nullable: false), - OvertimeAmount = table.Column(type: "numeric(18,2)", nullable: false), - GrossSalary = table.Column(type: "numeric(18,2)", nullable: false), - LateDeductionAmount = table.Column(type: "numeric(18,2)", nullable: false), - NoPayAmount = table.Column(type: "numeric(18,2)", nullable: false), - LoanDeductionAmount = table.Column(type: "numeric(18,2)", nullable: false), - EpfEmployeeAmount = table.Column(type: "numeric(18,2)", nullable: false), - EpfEmployerAmount = table.Column(type: "numeric(18,2)", nullable: false), - EtfEmployerAmount = table.Column(type: "numeric(18,2)", nullable: false), - TaxAmount = table.Column(type: "numeric(18,2)", nullable: false), - OtherDeductionsAmount = table.Column(type: "numeric(18,2)", nullable: false), - NetSalary = table.Column(type: "numeric(18,2)", nullable: false), - WorkingDays = table.Column(type: "integer", nullable: false), - PresentDays = table.Column(type: "integer", nullable: false), - AbsentDays = table.Column(type: "integer", nullable: false), - LeaveDays = table.Column(type: "integer", nullable: false), - OtMinutesTotal = table.Column(type: "integer", nullable: false), - LateMinutesTotal = table.Column(type: "integer", nullable: false), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + PayrollLineId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + PayrollRunId = table.Column(type: "int", nullable: false), + EmployeeId = table.Column(type: "int", nullable: false), + BasicSalary = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + TotalAllowances = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + OvertimeAmount = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + GrossSalary = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + LateDeductionAmount = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + NoPayAmount = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + LoanDeductionAmount = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + EpfEmployeeAmount = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + EpfEmployerAmount = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + EtfEmployerAmount = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + TaxAmount = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + OtherDeductionsAmount = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + NetSalary = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + WorkingDays = table.Column(type: "int", nullable: false), + PresentDays = table.Column(type: "int", nullable: false), + AbsentDays = table.Column(type: "int", nullable: false), + LeaveDays = table.Column(type: "int", nullable: false), + OtMinutesTotal = table.Column(type: "int", nullable: false), + LateMinutesTotal = table.Column(type: "int", nullable: false), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { @@ -2733,23 +3489,24 @@ namespace ERPCore.Migrations principalTable: "hr_payroll_runs", principalColumn: "PayrollRunId", onDelete: ReferentialAction.Cascade); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_loan_installments", columns: table => new { - LoanInstallmentId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - EmployeeLoanId = table.Column(type: "integer", nullable: false), - InstallmentNumber = table.Column(type: "integer", nullable: false), - DueYear = table.Column(type: "integer", nullable: false), - DueMonth = table.Column(type: "integer", nullable: false), - ScheduledAmount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - PaidAmount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: true), - PayrollRunId = table.Column(type: "integer", nullable: true), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) + LoanInstallmentId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + EmployeeLoanId = table.Column(type: "int", nullable: false), + InstallmentNumber = table.Column(type: "int", nullable: false), + DueYear = table.Column(type: "int", nullable: false), + DueMonth = table.Column(type: "int", nullable: false), + ScheduledAmount = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + PaidAmount = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: true), + PayrollRunId = table.Column(type: "int", nullable: true), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + RowVersion = table.Column(type: "int unsigned", nullable: false) }, constraints: table => { @@ -2766,47 +3523,49 @@ namespace ERPCore.Migrations principalTable: "hr_payroll_runs", principalColumn: "PayrollRunId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_employee_salary_structure_lines", columns: table => new { - EmployeeSalaryStructureLineId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - EmployeeSalaryStructureId = table.Column(type: "integer", nullable: false), - SalaryComponentId = table.Column(type: "integer", nullable: false), - Amount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false) + EmployeeSalaryStructureLineId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + EmployeeSalaryStructureId = table.Column(type: "int", nullable: false), + SalaryComponentId = table.Column(type: "int", nullable: false), + Amount = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false) }, constraints: table => { table.PrimaryKey("PK_hr_employee_salary_structure_lines", x => x.EmployeeSalaryStructureLineId); table.ForeignKey( - name: "FK_hr_employee_salary_structure_lines_hr_employee_salary_struc~", + name: "FK_hr_employee_salary_structure_lines_hr_employee_salary_struct~", column: x => x.EmployeeSalaryStructureId, principalTable: "hr_employee_salary_structures", principalColumn: "EmployeeSalaryStructureId", onDelete: ReferentialAction.Cascade); table.ForeignKey( - name: "FK_hr_employee_salary_structure_lines_hr_salary_components_Sal~", + name: "FK_hr_employee_salary_structure_lines_hr_salary_components_Sala~", column: x => x.SalaryComponentId, principalTable: "hr_salary_components", principalColumn: "SalaryComponentId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_payroll_line_components", columns: table => new { - PayrollLineComponentId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - PayrollLineId = table.Column(type: "integer", nullable: false), - ComponentCategory = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), - SalaryComponentId = table.Column(type: "integer", nullable: true), - Label = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Amount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - SortOrder = table.Column(type: "integer", nullable: false) + PayrollLineComponentId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + PayrollLineId = table.Column(type: "int", nullable: false), + ComponentCategory = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"), + SalaryComponentId = table.Column(type: "int", nullable: true), + Label = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + Amount = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), + SortOrder = table.Column(type: "int", nullable: false) }, constraints: table => { @@ -2818,23 +3577,24 @@ namespace ERPCore.Migrations principalColumn: "PayrollLineId", onDelete: ReferentialAction.Cascade); table.ForeignKey( - name: "FK_hr_payroll_line_components_hr_salary_components_SalaryCompo~", + name: "FK_hr_payroll_line_components_hr_salary_components_SalaryCompon~", column: x => x.SalaryComponentId, principalTable: "hr_salary_components", principalColumn: "SalaryComponentId", onDelete: ReferentialAction.Restrict); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.CreateTable( name: "hr_payslips", columns: table => new { - PayslipId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - PayrollLineId = table.Column(type: "integer", nullable: false), - GeneratedAt = table.Column(type: "timestamp with time zone", nullable: false), - ReleasedAt = table.Column(type: "timestamp with time zone", nullable: true), - ReleasedBy = table.Column(type: "integer", nullable: true) + PayslipId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + PayrollLineId = table.Column(type: "int", nullable: false), + GeneratedAt = table.Column(type: "datetime(6)", nullable: false), + ReleasedAt = table.Column(type: "datetime(6)", nullable: true), + ReleasedBy = table.Column(type: "int", nullable: true) }, constraints: table => { @@ -2845,7 +3605,8 @@ namespace ERPCore.Migrations principalTable: "hr_payroll_lines", principalColumn: "PayrollLineId", onDelete: ReferentialAction.Cascade); - }); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); migrationBuilder.InsertData( table: "nav_items", @@ -2854,7 +3615,6 @@ namespace ERPCore.Migrations { { 1, "dashboard", "/dashboard", null, "Dashboard", 1 }, { 2, "products", "/dashboard/products", null, "Products", 2 }, - { 3, "vendors", "/dashboard/vendors", null, "Vendors", 3 }, { 4, "procurement", "/dashboard/procurement", null, "Procurement", 4 }, { 5, "receiving", "/dashboard/receiving/grn", null, "Receiving", 5 }, { 6, "stock", "/dashboard/stock", null, "Stock", 6 }, @@ -2864,7 +3624,18 @@ namespace ERPCore.Migrations { 10, "help", "/dashboard/help", null, "Help", 10 }, { 11, "ledgers", "/dashboard/ledgers", null, "Ledgers", 11 }, { 12, "accounts", "/dashboard/accounts", null, "Accounts", 12 }, - { 13, "sales", "/dashboard/sales", null, "Sales", 13 } + { 13, "sales", "/dashboard/sales", null, "Sales", 13 }, + { 14, "production", "/dashboard/production", null, "Production", 14 } + }); + + migrationBuilder.InsertData( + table: "tax_rates", + columns: new[] { "TaxRateId", "Code", "CreatedAt", "Name", "Percentage", "RowVersion", "UpdatedAt" }, + values: new object[,] + { + { 1, "STANDARD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Standard", 15m, 1u, null }, + { 2, "ZERO", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Zero-Rated", 0m, 1u, null }, + { 3, "EXEMPT", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Exempt", 0m, 1u, null } }); migrationBuilder.InsertData( @@ -2879,7 +3650,6 @@ namespace ERPCore.Migrations { { 1, "NAV:dashboard", 1, null }, { 2, "NAV:products", 2, null }, - { 3, "NAV:vendors", 3, null }, { 4, "NAV:procurement", 4, null }, { 5, "NAV:receiving", 5, null }, { 6, "NAV:stock", 6, null }, @@ -2888,7 +3658,8 @@ namespace ERPCore.Migrations { 9, "NAV:settings", 9, null }, { 10, "NAV:help", 10, null }, { 19, "NAV:ledgers", 11, null }, - { 32, "NAV:accounts", 12, null } + { 32, "NAV:accounts", 12, null }, + { 35, "NAV:production", 14, null } }); migrationBuilder.InsertData( @@ -2918,7 +3689,26 @@ namespace ERPCore.Migrations { 20, "procurement.purchase-returns", "/dashboard/procurement/purchase-returns", null, "Purchase Returns", 4, 4 }, { 21, "accounts.cheque-books", "/dashboard/accounts/cheque-books", null, "Cheque Books", 12, 2 }, { 22, "accounts.received-cheques", "/dashboard/accounts/received-cheques", null, "Received Cheques", 12, 3 }, - { 23, "sales.bundle-sales", "/dashboard/sales/bundles", null, "Bundle Sales", 13, 1 } + { 23, "sales.bundle-templates", "/dashboard/sales/bundles/templates", null, "Bundle Templates", 13, 2 }, + { 24, "settings.notification-config", "/dashboard/settings/notification-config", null, "Notification Config", 9, 3 }, + { 25, "production.runs", "/dashboard/production/runs", null, "Runs", 14, 2 }, + { 26, "production.produced", "/dashboard/production/produced", null, "Produced", 14, 3 }, + { 27, "production.templates", "/dashboard/production/templates", null, "Templates", 14, 1 }, + { 28, "procurement.purchase-invoices", "/dashboard/procurement/purchase-invoices", null, "Purchase Invoices", 4, 5 }, + { 29, "settings.branches", "/dashboard/settings/branches", null, "Branches", 9, 0 }, + { 30, "procurement.vendors", "/dashboard/vendors", null, "Vendors", 4, 0 }, + { 31, "stock.ledger", "/dashboard/stock/ledger", null, "Stock Ledger", 6, 1 }, + { 32, "stock.enquiry", "/dashboard/stock/enquiry", null, "Stock Enquiry", 6, 2 }, + { 33, "stock.valuation", "/dashboard/stock/valuation", null, "Valuation", 6, 3 }, + { 34, "stock.transfers", "/dashboard/stock/transfers", null, "Transfers", 6, 4 }, + { 35, "stock.adjustments", "/dashboard/stock/adjustments", null, "Adjustments", 6, 5 }, + { 36, "stock.counts", "/dashboard/stock/counts", null, "Counts", 6, 6 }, + { 37, "stock.reorder-alerts", "/dashboard/stock/reorder-alerts", null, "Reorder Alerts", 6, 7 }, + { 38, "stock.wastage", "/dashboard/stock/wastage", null, "Wastage", 6, 8 }, + { 40, "sales.invoices", "/dashboard/sales/invoices", null, "Sales", 13, 1 }, + { 41, "sales.free-issues", "/dashboard/sales/free-issues", null, "Free Issues", 13, 3 }, + { 42, "sales.day-end", "/dashboard/sales/day-end", null, "Day End", 13, 4 }, + { 43, "products.tax-rates", "/dashboard/products/tax-rates", null, "Tax Rates", 2, 7 } }); migrationBuilder.InsertData( @@ -2926,6 +3716,7 @@ namespace ERPCore.Migrations columns: new[] { "PermissionId", "Code", "NavItemId", "SubNavItemId" }, values: new object[,] { + { 3, "NAV:procurement.vendors", null, 30 }, { 11, "NAV:products.item", null, 1 }, { 12, "NAV:products.category", null, 2 }, { 13, "NAV:products.brand", null, 3 }, @@ -2947,7 +3738,25 @@ namespace ERPCore.Migrations { 30, "NAV:procurement.purchase-orders", null, 19 }, { 31, "NAV:procurement.purchase-returns", null, 20 }, { 33, "NAV:accounts.cheque-books", null, 21 }, - { 34, "NAV:accounts.received-cheques", null, 22 } + { 34, "NAV:accounts.received-cheques", null, 22 }, + { 36, "NAV:production.templates", null, 27 }, + { 37, "NAV:production.runs", null, 25 }, + { 38, "NAV:production.produced", null, 26 }, + { 39, "NAV:procurement.purchase-invoices", null, 28 }, + { 40, "NAV:settings.branches", null, 29 }, + { 41, "NAV:stock.ledger", null, 31 }, + { 42, "NAV:stock.enquiry", null, 32 }, + { 43, "NAV:stock.valuation", null, 33 }, + { 44, "NAV:stock.transfers", null, 34 }, + { 45, "NAV:stock.adjustments", null, 35 }, + { 46, "NAV:stock.counts", null, 36 }, + { 47, "NAV:stock.reorder-alerts", null, 37 }, + { 48, "NAV:stock.wastage", null, 38 }, + { 49, "NAV:sales.bundle-templates", null, 23 }, + { 50, "NAV:sales.invoices", null, 40 }, + { 51, "NAV:sales.free-issues", null, 41 }, + { 52, "NAV:sales.day-end", null, 42 }, + { 53, "NAV:products.tax-rates", null, 43 } }); migrationBuilder.CreateIndex( @@ -2965,6 +3774,12 @@ namespace ERPCore.Migrations table: "audit_logs", column: "UserId"); + migrationBuilder.CreateIndex( + name: "IX_batches_Barcode", + table: "batches", + column: "Barcode", + unique: true); + migrationBuilder.CreateIndex( name: "IX_batches_ItemId_BatchNo", table: "batches", @@ -2977,6 +3792,11 @@ namespace ERPCore.Migrations columns: new[] { "WarehouseId", "Code" }, unique: true); + migrationBuilder.CreateIndex( + name: "IX_branch_config_UpdatedBy", + table: "branch_config", + column: "UpdatedBy"); + migrationBuilder.CreateIndex( name: "IX_brands_Name", table: "brands", @@ -3045,6 +3865,11 @@ namespace ERPCore.Migrations table: "bundle_sales", column: "CustomerId"); + migrationBuilder.CreateIndex( + name: "IX_bundle_sales_DayEndId", + table: "bundle_sales", + column: "DayEndId"); + migrationBuilder.CreateIndex( name: "IX_bundle_sales_WarehouseId", table: "bundle_sales", @@ -3061,6 +3886,11 @@ namespace ERPCore.Migrations table: "categories", column: "Status"); + migrationBuilder.CreateIndex( + name: "IX_customers_BranchId", + table: "customers", + column: "BranchId"); + migrationBuilder.CreateIndex( name: "IX_customers_CustomerCode", table: "customers", @@ -3082,6 +3912,12 @@ namespace ERPCore.Migrations table: "customers", column: "Status"); + migrationBuilder.CreateIndex( + name: "IX_grn_line_warranty_numbers_GrnLineId_WarrantyNo", + table: "grn_line_warranty_numbers", + columns: new[] { "GrnLineId", "WarrantyNo" }, + unique: true); + migrationBuilder.CreateIndex( name: "IX_grn_lines_BatchId", table: "grn_lines", @@ -3107,6 +3943,11 @@ namespace ERPCore.Migrations table: "grn_lines", column: "PoLineId"); + migrationBuilder.CreateIndex( + name: "IX_grns_BranchId", + table: "grns", + column: "BranchId"); + migrationBuilder.CreateIndex( name: "IX_grns_CreatedBy", table: "grns", @@ -3123,6 +3964,11 @@ namespace ERPCore.Migrations table: "grns", column: "PoId"); + migrationBuilder.CreateIndex( + name: "IX_grns_PurchaseInvoiceId", + table: "grns", + column: "PurchaseInvoiceId"); + migrationBuilder.CreateIndex( name: "IX_grns_Status", table: "grns", @@ -3507,6 +4353,12 @@ namespace ERPCore.Migrations table: "item_types", column: "Status"); + migrationBuilder.CreateIndex( + name: "IX_items_Barcode", + table: "items", + column: "Barcode", + unique: true); + migrationBuilder.CreateIndex( name: "IX_items_BaseUomId", table: "items", @@ -3543,11 +4395,21 @@ namespace ERPCore.Migrations table: "items", column: "SubCategoryId"); + migrationBuilder.CreateIndex( + name: "IX_items_TaxRateId", + table: "items", + column: "TaxRateId"); + migrationBuilder.CreateIndex( name: "IX_journal_entry_stubs_SourceDocType_SourceDocId", table: "journal_entry_stubs", columns: new[] { "SourceDocType", "SourceDocId" }); + migrationBuilder.CreateIndex( + name: "IX_login_activities_UserId_LoginAt", + table: "login_activities", + columns: new[] { "UserId", "LoginAt" }); + migrationBuilder.CreateIndex( name: "IX_nav_items_Code", table: "nav_items", @@ -3555,9 +4417,45 @@ namespace ERPCore.Migrations unique: true); migrationBuilder.CreateIndex( - name: "IX_number_sequences_doc_type_year", + name: "IX_notification_config_UpdatedBy", + table: "notification_config", + column: "UpdatedBy"); + + migrationBuilder.CreateIndex( + name: "IX_notification_config_modules_ModuleKey", + table: "notification_config_modules", + column: "ModuleKey", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_notification_config_modules_NotificationConfigId", + table: "notification_config_modules", + column: "NotificationConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_notification_recipients_NotificationId", + table: "notification_recipients", + column: "NotificationId"); + + migrationBuilder.CreateIndex( + name: "IX_notification_recipients_UserId_IsRead_NotificationId", + table: "notification_recipients", + columns: new[] { "UserId", "IsRead", "NotificationId" }); + + migrationBuilder.CreateIndex( + name: "IX_notifications_CreatedAt", + table: "notifications", + column: "CreatedAt"); + + migrationBuilder.CreateIndex( + name: "IX_number_sequences_branch_id", table: "number_sequences", - columns: new[] { "doc_type", "year" }, + column: "branch_id"); + + migrationBuilder.CreateIndex( + name: "IX_number_sequences_doc_type_branch_id_year", + table: "number_sequences", + columns: new[] { "doc_type", "branch_id", "year" }, unique: true); migrationBuilder.CreateIndex( @@ -3648,6 +4546,68 @@ namespace ERPCore.Migrations table: "production_templates", column: "Status"); + migrationBuilder.CreateIndex( + name: "IX_purchase_invoice_lines_GrnId", + table: "purchase_invoice_lines", + column: "GrnId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_purchase_invoice_lines_PurchaseInvoiceId", + table: "purchase_invoice_lines", + column: "PurchaseInvoiceId"); + + migrationBuilder.CreateIndex( + name: "IX_purchase_invoice_payments_CreatedBy", + table: "purchase_invoice_payments", + column: "CreatedBy"); + + migrationBuilder.CreateIndex( + name: "IX_purchase_invoice_payments_PurchaseInvoiceId", + table: "purchase_invoice_payments", + column: "PurchaseInvoiceId"); + + migrationBuilder.CreateIndex( + name: "IX_purchase_invoices_BranchId", + table: "purchase_invoices", + column: "BranchId"); + + migrationBuilder.CreateIndex( + name: "IX_purchase_invoices_CreatedBy", + table: "purchase_invoices", + column: "CreatedBy"); + + migrationBuilder.CreateIndex( + name: "IX_purchase_invoices_DocNo", + table: "purchase_invoices", + column: "DocNo", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_purchase_invoices_Status", + table: "purchase_invoices", + column: "Status"); + + migrationBuilder.CreateIndex( + name: "IX_purchase_invoices_VendorId", + table: "purchase_invoices", + column: "VendorId"); + + migrationBuilder.CreateIndex( + name: "IX_purchase_invoices_VendorId_VendorInvoiceNo", + table: "purchase_invoices", + columns: new[] { "VendorId", "VendorInvoiceNo" }); + + migrationBuilder.CreateIndex( + name: "IX_purchase_orders_ApproverUserId", + table: "purchase_orders", + column: "ApproverUserId"); + + migrationBuilder.CreateIndex( + name: "IX_purchase_orders_BranchId", + table: "purchase_orders", + column: "BranchId"); + migrationBuilder.CreateIndex( name: "IX_purchase_orders_CreatedBy", table: "purchase_orders", @@ -3731,6 +4691,11 @@ namespace ERPCore.Migrations table: "requisition_lines", column: "RequisitionId"); + migrationBuilder.CreateIndex( + name: "IX_requisitions_BranchId", + table: "requisitions", + column: "BranchId"); + migrationBuilder.CreateIndex( name: "IX_requisitions_DocNo", table: "requisitions", @@ -3757,6 +4722,11 @@ namespace ERPCore.Migrations table: "rfq_lines", column: "RfqId"); + migrationBuilder.CreateIndex( + name: "IX_rfqs_BranchId", + table: "rfqs", + column: "BranchId"); + migrationBuilder.CreateIndex( name: "IX_rfqs_DocNo", table: "rfqs", @@ -3861,6 +4831,23 @@ namespace ERPCore.Migrations table: "run_stages", column: "TemplateStageId"); + migrationBuilder.CreateIndex( + name: "IX_sales_day_ends_CashierUserId_BusinessDate", + table: "sales_day_ends", + columns: new[] { "CashierUserId", "BusinessDate" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_sales_day_ends_ClosedBy", + table: "sales_day_ends", + column: "ClosedBy"); + + migrationBuilder.CreateIndex( + name: "IX_sales_day_ends_DocNo", + table: "sales_day_ends", + column: "DocNo", + unique: true); + migrationBuilder.CreateIndex( name: "IX_sales_invoice_lines_ItemId", table: "sales_invoice_lines", @@ -3876,6 +4863,21 @@ namespace ERPCore.Migrations table: "sales_invoice_lines", column: "WarehouseId"); + migrationBuilder.CreateIndex( + name: "IX_sales_invoice_payments_CreatedBy", + table: "sales_invoice_payments", + column: "CreatedBy"); + + migrationBuilder.CreateIndex( + name: "IX_sales_invoice_payments_SalesInvoiceId", + table: "sales_invoice_payments", + column: "SalesInvoiceId"); + + migrationBuilder.CreateIndex( + name: "IX_sales_invoices_BranchId", + table: "sales_invoices", + column: "BranchId"); + migrationBuilder.CreateIndex( name: "IX_sales_invoices_CreatorUserId", table: "sales_invoices", @@ -3907,6 +4909,52 @@ namespace ERPCore.Migrations table: "sales_invoices", column: "WarehouseId"); + migrationBuilder.CreateIndex( + name: "IX_sales_return_lines_ItemId", + table: "sales_return_lines", + column: "ItemId"); + + migrationBuilder.CreateIndex( + name: "IX_sales_return_lines_ReturnId", + table: "sales_return_lines", + column: "ReturnId"); + + migrationBuilder.CreateIndex( + name: "IX_sales_return_lines_SalesInvoiceLineId", + table: "sales_return_lines", + column: "SalesInvoiceLineId"); + + migrationBuilder.CreateIndex( + name: "IX_sales_returns_CreatedBy", + table: "sales_returns", + column: "CreatedBy"); + + migrationBuilder.CreateIndex( + name: "IX_sales_returns_CustomerId", + table: "sales_returns", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_sales_returns_DocNo", + table: "sales_returns", + column: "DocNo", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_sales_returns_ReasonCodeId", + table: "sales_returns", + column: "ReasonCodeId"); + + migrationBuilder.CreateIndex( + name: "IX_sales_returns_WarehouseId", + table: "sales_returns", + column: "WarehouseId"); + + migrationBuilder.CreateIndex( + name: "IX_sales_slip_lines_BatchId", + table: "sales_slip_lines", + column: "BatchId"); + migrationBuilder.CreateIndex( name: "IX_sales_slip_lines_ItemId", table: "sales_slip_lines", @@ -3917,6 +4965,11 @@ namespace ERPCore.Migrations table: "sales_slip_lines", column: "SalesSlipId"); + migrationBuilder.CreateIndex( + name: "IX_sales_slip_lines_SerialId", + table: "sales_slip_lines", + column: "SerialId"); + migrationBuilder.CreateIndex( name: "IX_sales_slip_lines_WarehouseId", table: "sales_slip_lines", @@ -3932,6 +4985,11 @@ namespace ERPCore.Migrations table: "sales_slips", column: "CustomerId"); + migrationBuilder.CreateIndex( + name: "IX_sales_slips_DayEndId", + table: "sales_slips", + column: "DayEndId"); + migrationBuilder.CreateIndex( name: "IX_sales_slips_SlipDate", table: "sales_slips", @@ -3953,6 +5011,12 @@ namespace ERPCore.Migrations table: "sales_slips", column: "WarehouseId"); + migrationBuilder.CreateIndex( + name: "IX_serials_Barcode", + table: "serials", + column: "Barcode", + unique: true); + migrationBuilder.CreateIndex( name: "IX_serials_ItemId_SerialNo", table: "serials", @@ -4030,6 +5094,11 @@ namespace ERPCore.Migrations table: "stock_adjustment_lines", column: "SerialId"); + migrationBuilder.CreateIndex( + name: "IX_stock_adjustments_BranchId", + table: "stock_adjustments", + column: "BranchId"); + migrationBuilder.CreateIndex( name: "IX_stock_adjustments_CreatedBy", table: "stock_adjustments", @@ -4051,6 +5120,11 @@ namespace ERPCore.Migrations table: "stock_adjustments", column: "WarehouseId"); + migrationBuilder.CreateIndex( + name: "IX_stock_count_lines_BatchId", + table: "stock_count_lines", + column: "BatchId"); + migrationBuilder.CreateIndex( name: "IX_stock_count_lines_BinId", table: "stock_count_lines", @@ -4066,6 +5140,16 @@ namespace ERPCore.Migrations table: "stock_count_lines", column: "ItemId"); + migrationBuilder.CreateIndex( + name: "IX_stock_count_lines_SerialId", + table: "stock_count_lines", + column: "SerialId"); + + migrationBuilder.CreateIndex( + name: "IX_stock_counts_BranchId", + table: "stock_counts", + column: "BranchId"); + migrationBuilder.CreateIndex( name: "IX_stock_counts_CreatedBy", table: "stock_counts", @@ -4182,6 +5266,11 @@ namespace ERPCore.Migrations table: "stock_transfer_lines", column: "TransferId"); + migrationBuilder.CreateIndex( + name: "IX_stock_transfers_BranchId", + table: "stock_transfers", + column: "BranchId"); + migrationBuilder.CreateIndex( name: "IX_stock_transfers_CreatedBy", table: "stock_transfers", @@ -4230,6 +5319,32 @@ namespace ERPCore.Migrations table: "subcategories", column: "Status"); + migrationBuilder.CreateIndex( + name: "IX_support_ticket_messages_TicketId_CreatedAt", + table: "support_ticket_messages", + columns: new[] { "TicketId", "CreatedAt" }); + + migrationBuilder.CreateIndex( + name: "IX_support_tickets_CreatedBy", + table: "support_tickets", + column: "CreatedBy"); + + migrationBuilder.CreateIndex( + name: "IX_support_tickets_Status", + table: "support_tickets", + column: "Status"); + + migrationBuilder.CreateIndex( + name: "IX_tax_rates_Code", + table: "tax_rates", + column: "Code", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_tax_rates_Status", + table: "tax_rates", + column: "Status"); + migrationBuilder.CreateIndex( name: "IX_template_stages_TemplateId", table: "template_stages", @@ -4241,6 +5356,11 @@ namespace ERPCore.Migrations column: "Name", unique: true); + migrationBuilder.CreateIndex( + name: "IX_uoms_Status", + table: "uoms", + column: "Status"); + migrationBuilder.CreateIndex( name: "IX_users_auth_user_id", table: "users", @@ -4285,6 +5405,11 @@ namespace ERPCore.Migrations table: "vendor_quotations", column: "VendorId"); + migrationBuilder.CreateIndex( + name: "IX_vendors_BranchId", + table: "vendors", + column: "BranchId"); + migrationBuilder.CreateIndex( name: "IX_vendors_Code", table: "vendors", @@ -4296,6 +5421,11 @@ namespace ERPCore.Migrations table: "vendors", column: "Status"); + migrationBuilder.CreateIndex( + name: "IX_warehouses_BranchId", + table: "warehouses", + column: "BranchId"); + migrationBuilder.CreateIndex( name: "IX_warehouses_Code", table: "warehouses", @@ -4326,6 +5456,14 @@ namespace ERPCore.Migrations name: "FK_hr_employees_users_UserId", table: "hr_employees"); + migrationBuilder.DropForeignKey( + name: "FK_hr_departments_hr_branches_BranchId", + table: "hr_departments"); + + migrationBuilder.DropForeignKey( + name: "FK_hr_employees_hr_branches_BranchId", + table: "hr_employees"); + migrationBuilder.DropForeignKey( name: "FK_hr_departments_hr_employees_HeadEmployeeId", table: "hr_departments"); @@ -4333,12 +5471,18 @@ namespace ERPCore.Migrations migrationBuilder.DropTable( name: "audit_logs"); + migrationBuilder.DropTable( + name: "branch_config"); + migrationBuilder.DropTable( name: "bundle_sale_lines"); migrationBuilder.DropTable( name: "bundle_sale_template_lines"); + migrationBuilder.DropTable( + name: "grn_line_warranty_numbers"); + migrationBuilder.DropTable( name: "hr_attendance_records"); @@ -4381,12 +5525,27 @@ namespace ERPCore.Migrations migrationBuilder.DropTable( name: "journal_entry_stubs"); + migrationBuilder.DropTable( + name: "login_activities"); + + migrationBuilder.DropTable( + name: "notification_config_modules"); + + migrationBuilder.DropTable( + name: "notification_recipients"); + migrationBuilder.DropTable( name: "number_sequences"); migrationBuilder.DropTable( name: "product_config"); + migrationBuilder.DropTable( + name: "purchase_invoice_lines"); + + migrationBuilder.DropTable( + name: "purchase_invoice_payments"); + migrationBuilder.DropTable( name: "purchase_return_lines"); @@ -4409,7 +5568,10 @@ namespace ERPCore.Migrations name: "run_stage_inputs"); migrationBuilder.DropTable( - name: "sales_invoice_lines"); + name: "sales_invoice_payments"); + + migrationBuilder.DropTable( + name: "sales_return_lines"); migrationBuilder.DropTable( name: "sales_slip_lines"); @@ -4435,6 +5597,9 @@ namespace ERPCore.Migrations migrationBuilder.DropTable( name: "stock_transfer_lines"); + migrationBuilder.DropTable( + name: "support_ticket_messages"); + migrationBuilder.DropTable( name: "vendor_quotation_lines"); @@ -4462,6 +5627,12 @@ namespace ERPCore.Migrations migrationBuilder.DropTable( name: "hr_payroll_lines"); + migrationBuilder.DropTable( + name: "notification_config"); + + migrationBuilder.DropTable( + name: "notifications"); + migrationBuilder.DropTable( name: "purchase_returns"); @@ -4472,7 +5643,10 @@ namespace ERPCore.Migrations name: "run_stage_outputs"); migrationBuilder.DropTable( - name: "sales_invoices"); + name: "sales_invoice_lines"); + + migrationBuilder.DropTable( + name: "sales_returns"); migrationBuilder.DropTable( name: "sales_slips"); @@ -4495,6 +5669,9 @@ namespace ERPCore.Migrations migrationBuilder.DropTable( name: "stock_transfers"); + migrationBuilder.DropTable( + name: "support_tickets"); + migrationBuilder.DropTable( name: "vendor_quotations"); @@ -4511,7 +5688,10 @@ namespace ERPCore.Migrations name: "run_stages"); migrationBuilder.DropTable( - name: "customers"); + name: "sales_invoices"); + + migrationBuilder.DropTable( + name: "sales_day_ends"); migrationBuilder.DropTable( name: "batches"); @@ -4534,6 +5714,12 @@ namespace ERPCore.Migrations migrationBuilder.DropTable( name: "template_stages"); + migrationBuilder.DropTable( + name: "customers"); + + migrationBuilder.DropTable( + name: "purchase_invoices"); + migrationBuilder.DropTable( name: "items"); @@ -4555,6 +5741,9 @@ namespace ERPCore.Migrations migrationBuilder.DropTable( name: "subcategories"); + migrationBuilder.DropTable( + name: "tax_rates"); + migrationBuilder.DropTable( name: "uoms"); @@ -4576,6 +5765,9 @@ namespace ERPCore.Migrations migrationBuilder.DropTable( name: "roles"); + migrationBuilder.DropTable( + name: "hr_branches"); + migrationBuilder.DropTable( name: "hr_employees"); @@ -4590,9 +5782,6 @@ namespace ERPCore.Migrations migrationBuilder.DropTable( name: "hr_work_shifts"); - - migrationBuilder.DropTable( - name: "hr_branches"); } } } diff --git a/Backend/ERPCore/Migrations/20260930062500_AddProductConfigCustomVariants.Designer.cs b/Backend/ERPCore/Migrations/20261005111955_AddSalesGrnConfigItemImagesWarrantyPeriods.Designer.cs similarity index 76% rename from Backend/ERPCore/Migrations/20260930062500_AddProductConfigCustomVariants.Designer.cs rename to Backend/ERPCore/Migrations/20261005111955_AddSalesGrnConfigItemImagesWarrantyPeriods.Designer.cs index 9598c11..d79413d 100644 --- a/Backend/ERPCore/Migrations/20260930062500_AddProductConfigCustomVariants.Designer.cs +++ b/Backend/ERPCore/Migrations/20261005111955_AddSalesGrnConfigItemImagesWarrantyPeriods.Designer.cs @@ -3,97 +3,96 @@ using System; using ERPCore.Infra.Persistence; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace ERPCore.Migrations { [DbContext(typeof(ErpDbContext))] - [Migration("20260930062500_AddProductConfigCustomVariants")] - partial class AddProductConfigCustomVariants + [Migration("20261005111955_AddSalesGrnConfigItemImagesWarrantyPeriods")] + partial class AddSalesGrnConfigItemImagesWarrantyPeriods { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); + .UseCollation("utf8mb4_unicode_ci") + .HasAnnotation("ProductVersion", "9.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 64); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => { b.Property("AttendanceRecordId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("AttendanceRecordId")); b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("AttendanceStatus") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CheckIn") - .HasColumnType("interval"); + .HasColumnType("time(6)"); b.Property("CheckOut") - .HasColumnType("interval"); + .HasColumnType("time(6)"); b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EditedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("IsManualOverride") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("LateMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Notes") .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); + .HasColumnType("varchar(1000)"); b.Property("OvertimeMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowValidationStatus") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("WorkShiftId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WorkingMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("AttendanceRecordId"); @@ -110,61 +109,59 @@ namespace ERPCore.Migrations { b.Property("AttendanceUploadBatchId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("AttendanceUploadBatchId")); b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ConfirmedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("OriginalFileName") .HasMaxLength(260) - .HasColumnType("character varying(260)"); + .HasColumnType("varchar(260)"); b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("RowCountDuplicate") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowCountError") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowCountTotal") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SourceType") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UploadedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("AttendanceUploadBatchId"); @@ -182,32 +179,32 @@ namespace ERPCore.Migrations { b.Property("AuditId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("AuditId")); b.Property("Action") .IsRequired() .HasMaxLength(10) - .HasColumnType("character varying(10)"); + .HasColumnType("varchar(10)"); b.Property("ChangeSet") .IsRequired() - .HasColumnType("jsonb"); + .HasColumnType("longtext"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EntityId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EntityType") .IsRequired() .HasMaxLength(80) - .HasColumnType("character varying(80)"); + .HasColumnType("varchar(80)"); b.Property("UserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("AuditId"); @@ -224,24 +221,24 @@ namespace ERPCore.Migrations { b.Property("BatchId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BatchId")); b.Property("Barcode") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("BatchNo") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("ExpiryDate") .HasColumnType("date"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("BatchId"); @@ -258,21 +255,21 @@ namespace ERPCore.Migrations { b.Property("BinId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BinId")); b.Property("BinType") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Code") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("BinId"); @@ -286,46 +283,44 @@ namespace ERPCore.Migrations { b.Property("BranchId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BranchId")); b.Property("Address") .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("PhoneNumber") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("BranchId"); @@ -340,27 +335,25 @@ namespace ERPCore.Migrations modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => { b.Property("ConfigId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BranchingEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UpdatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.HasKey("ConfigId"); @@ -368,7 +361,7 @@ namespace ERPCore.Migrations b.ToTable("branch_config", null, t => { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); + t.HasCheckConstraint("ck_branch_config_singleton", "`ConfigId` = 1"); }); }); @@ -376,33 +369,31 @@ namespace ERPCore.Migrations { b.Property("BrandId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BrandId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("BrandId"); @@ -418,90 +409,88 @@ namespace ERPCore.Migrations { b.Property("BundleSaleId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BundleSaleId")); b.Property("BundleCode") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("BundleName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("BundleNo") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("BundlePrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CashierUserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ComponentSubtotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); + .HasColumnType("decimal(18,4)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CustomerId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CustomerSnapshotName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("DayEndId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DiscountTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("GrandTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("MarginAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Draft"); b.Property("TaxTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("BundleSaleId"); @@ -525,48 +514,48 @@ namespace ERPCore.Migrations { b.Property("BundleSaleLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BundleSaleLineId")); b.Property("BundleSaleId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Description") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("IncludeInBundle") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("IsComponent") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LineTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ParentLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("UnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("BundleSaleLineId"); @@ -583,42 +572,40 @@ namespace ERPCore.Migrations { b.Property("BundleSaleTemplateId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BundleSaleTemplateId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Description") .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); + .HasColumnType("varchar(1000)"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("TemplateCode") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("TemplateName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("BundleSaleTemplateId"); @@ -632,34 +619,34 @@ namespace ERPCore.Migrations { b.Property("BundleSaleTemplateLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BundleSaleTemplateLineId")); b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("IncludeInBundle") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("SortOrder") .ValueGeneratedOnAdd() - .HasColumnType("integer") + .HasColumnType("int") .HasDefaultValue(0); b.Property("UnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("BundleSaleTemplateLineId"); @@ -676,33 +663,31 @@ namespace ERPCore.Migrations { b.Property("CategoryId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CategoryId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("CategoryId"); @@ -718,90 +703,88 @@ namespace ERPCore.Migrations { b.Property("CustomerId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CustomerId")); b.Property("AddressLine1") .HasMaxLength(250) - .HasColumnType("character varying(250)"); + .HasColumnType("varchar(250)"); b.Property("AddressLine2") .HasMaxLength(250) - .HasColumnType("character varying(250)"); + .HasColumnType("varchar(250)"); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("City") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("Country") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreditDays") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreditLimit") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("CustomerCode") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("CustomerType") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("B2C"); b.Property("DefaultWarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DisplayName") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("Email") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("Phone") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("TaxRegistrationNo") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("CustomerId"); @@ -823,47 +806,45 @@ namespace ERPCore.Migrations { b.Property("DepartmentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("DepartmentId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("HeadEmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("ParentDepartmentId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("DepartmentId"); @@ -885,38 +866,36 @@ namespace ERPCore.Migrations { b.Property("DesignationId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("DesignationId")); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("DesignationId"); @@ -932,145 +911,143 @@ namespace ERPCore.Migrations { b.Property("EmployeeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EmployeeId")); b.Property("AddressLine1") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("AddressLine2") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("City") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Country") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("DepartmentId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DesignationId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Email") .HasMaxLength(320) - .HasColumnType("character varying(320)"); + .HasColumnType("varchar(320)"); b.Property("EmergencyContactName") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("EmergencyContactPhone") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("EmergencyContactRelationship") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("EmployeeCode") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("EmploymentTypeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EpfNumber") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("EtfNumber") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("FullName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("Gender") .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("HireDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Nationality") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("Nic") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("PersonalMobile") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("PostalCode") .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("ProfilePhotoPath") .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("ReportingManagerId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("TaxIdentificationNumber") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UpdatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("UserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WorkShiftId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("EmployeeId"); @@ -1103,58 +1080,56 @@ namespace ERPCore.Migrations { b.Property("EmployeeBankDetailId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EmployeeBankDetailId")); b.Property("AccountHolderName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("AccountNumber") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("BankName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("BranchName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("IsPrimary") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("SwiftCode") .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("EmployeeBankDetailId"); @@ -1167,46 +1142,44 @@ namespace ERPCore.Migrations { b.Property("EmployeeDocumentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EmployeeDocumentId")); b.Property("ContentType") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("HrDocumentTypeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Notes") .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); + .HasColumnType("varchar(1000)"); b.Property("OriginalFileName") .IsRequired() .HasMaxLength(260) - .HasColumnType("character varying(260)"); + .HasColumnType("varchar(260)"); b.Property("RelativePath") .IsRequired() .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SizeBytes") .HasColumnType("bigint"); @@ -1215,25 +1188,25 @@ namespace ERPCore.Migrations .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("StoredFileName") .IsRequired() .HasMaxLength(260) - .HasColumnType("character varying(260)"); + .HasColumnType("varchar(260)"); b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UploadedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("VerifiedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("EmployeeDocumentId"); @@ -1250,70 +1223,68 @@ namespace ERPCore.Migrations { b.Property("EmployeeLoanId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EmployeeLoanId")); b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ApprovedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("InstallmentAmount") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("InterestRate") .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); + .HasColumnType("decimal(6,4)"); b.Property("LoanKind") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("NumberOfInstallments") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("OutstandingBalance") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("PrincipalAmount") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("StartMonth") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("StartYear") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("EmployeeLoanId"); @@ -1331,50 +1302,48 @@ namespace ERPCore.Migrations { b.Property("EmployeeSalaryStructureId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EmployeeSalaryStructureId")); b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ApprovedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BasicSalary") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Currency") .IsRequired() .HasMaxLength(3) - .HasColumnType("character varying(3)"); + .HasColumnType("varchar(3)"); b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("EmployeeSalaryStructureId"); @@ -1387,19 +1356,19 @@ namespace ERPCore.Migrations { b.Property("EmployeeSalaryStructureLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EmployeeSalaryStructureLineId")); b.Property("Amount") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SalaryComponentId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("EmployeeSalaryStructureLineId"); @@ -1414,38 +1383,36 @@ namespace ERPCore.Migrations { b.Property("EmploymentTypeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EmploymentTypeId")); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("EmploymentTypeId"); @@ -1461,56 +1428,54 @@ namespace ERPCore.Migrations { b.Property("GrnId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("GrnId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("PoId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("VendorId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("GrnId"); @@ -1534,69 +1499,114 @@ namespace ERPCore.Migrations b.ToTable("grns", (string)null); }); + modelBuilder.Entity("ERPCore.Domain.Entities.GrnConfig", b => + { + b.Property("ConfigId") + .HasColumnType("int"); + + b.Property("AllowDiscounts") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("AllowVat") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("AllowWarehouseSelection") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("DefaultWarehouseId") + .HasColumnType("int"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .HasColumnType("int unsigned"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedBy") + .HasColumnType("int"); + + b.HasKey("ConfigId"); + + b.HasIndex("DefaultWarehouseId"); + + b.HasIndex("UpdatedBy"); + + b.ToTable("grn_config", null, t => + { + t.HasCheckConstraint("ck_grn_config_singleton", "\"ConfigId\" = 1"); + }); + }); + modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => { b.Property("GrnLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("GrnLineId")); b.Property("BatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BinId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DiscountPct") .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); + .HasColumnType("decimal(9,4)"); b.Property("GrnId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("HoldStatus") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LineTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("NetUnitCost") .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); + .HasColumnType("decimal(18,6)"); b.Property("PoLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PoUnitPrice") .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); + .HasColumnType("decimal(18,6)"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ReceivedValue") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("UnitCost") .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); + .HasColumnType("decimal(18,6)"); b.Property("VatAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("VatPct") .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); + .HasColumnType("decimal(9,4)"); b.HasKey("GrnLineId"); @@ -1617,20 +1627,20 @@ namespace ERPCore.Migrations { b.Property("GrnLineWarrantyNumberId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("GrnLineWarrantyNumberId")); b.Property("GrnLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WarrantyNo") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("GrnLineWarrantyNumberId"); @@ -1644,49 +1654,47 @@ namespace ERPCore.Migrations { b.Property("HrDocumentTypeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("HrDocumentTypeId")); b.Property("Category") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ExpiryTracked") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("HrDocumentTypeId"); @@ -1702,112 +1710,110 @@ namespace ERPCore.Migrations { b.Property("ItemId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ItemId")); b.Property("Barcode") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("BaseUomId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BrandId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CategoryId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ContentBaseQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ContentBaseUnit") .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("ContentQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ContentUnit") .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("DefaultVendorId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Description") .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); + .HasColumnType("varchar(1000)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SellingFlatPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("SellingMaxPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("SellingMinPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("Sku") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("StockNature") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("SubCategoryId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("TaxRateId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("TrackingMode") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Warranty") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("NonWarranty"); b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ItemId"); @@ -1834,27 +1840,77 @@ namespace ERPCore.Migrations b.ToTable("items", (string)null); }); + modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => + { + b.Property("ItemImageId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ItemImageId")); + + b.Property("ContentType") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("ItemId") + .HasColumnType("int"); + + b.Property("OriginalFileName") + .IsRequired() + .HasMaxLength(260) + .HasColumnType("varchar(260)"); + + b.Property("RelativePath") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.Property("SizeBytes") + .HasColumnType("bigint"); + + b.Property("SortOrder") + .HasColumnType("int"); + + b.Property("StoredFileName") + .IsRequired() + .HasMaxLength(260) + .HasColumnType("varchar(260)"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.Property("UploadedBy") + .HasColumnType("int"); + + b.HasKey("ItemImageId"); + + b.HasIndex("ItemId", "SortOrder"); + + b.ToTable("item_images", (string)null); + }); + modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => { b.Property("ReorderId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ReorderId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ReorderPoint") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ReorderQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ReorderId"); @@ -1870,38 +1926,36 @@ namespace ERPCore.Migrations { b.Property("ItemTypeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ItemTypeId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("IsMeasurable") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("ItemTypeId"); @@ -1917,31 +1971,31 @@ namespace ERPCore.Migrations { b.Property("JournalId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JournalId")); b.Property("Amount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("CreditAccount") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("DebitAccount") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("SourceDocId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SourceDocType") .IsRequired() .HasMaxLength(10) - .HasColumnType("character varying(10)"); + .HasColumnType("varchar(10)"); b.HasKey("JournalId"); @@ -1954,43 +2008,41 @@ namespace ERPCore.Migrations { b.Property("LeaveBalanceId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("LeaveBalanceId")); b.Property("AdjustmentDays") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("CarriedForwardDays") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EntitledDays") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("LeaveTypeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("TakenDays") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Year") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("LeaveBalanceId"); @@ -2006,61 +2058,59 @@ namespace ERPCore.Migrations { b.Property("LeaveRequestId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("LeaveRequestId")); b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ApprovedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DaysCount") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EndDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("LeaveTypeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Reason") .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); + .HasColumnType("varchar(1000)"); b.Property("RejectionReason") .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); + .HasColumnType("varchar(1000)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("StartDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("LeaveRequestId"); @@ -2082,57 +2132,55 @@ namespace ERPCore.Migrations { b.Property("LeaveTypeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("LeaveTypeId")); b.Property("AccrualPerYear") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CountsAsNoPay") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("IsPaid") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RequiresApproval") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("LeaveTypeId"); @@ -2148,43 +2196,41 @@ namespace ERPCore.Migrations { b.Property("LoanInstallmentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("LoanInstallmentId")); b.Property("DueMonth") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DueYear") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EmployeeLoanId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("InstallmentNumber") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PaidAmount") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("PayrollRunId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("ScheduledAmount") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("LoanInstallmentId"); @@ -2201,27 +2247,27 @@ namespace ERPCore.Migrations { b.Property("LoginActivityId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("LoginActivityId")); b.Property("DeviceLabel") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("IpAddress") .HasMaxLength(64) - .HasColumnType("character varying(64)"); + .HasColumnType("varchar(64)"); b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UserAgent") .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("UserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("LoginActivityId"); @@ -2234,36 +2280,36 @@ namespace ERPCore.Migrations { b.Property("NavItemId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("NavItemId")); b.Property("Code") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Href") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("Icon") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Label") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("SortOrder") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.HasKey("NavItemId"); @@ -2397,34 +2443,34 @@ namespace ERPCore.Migrations { b.Property("NotificationId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("NotificationId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Message") .IsRequired() .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); + .HasColumnType("varchar(1000)"); b.Property("ModuleKey") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("RelatedEntityId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RelatedEntityType") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("Title") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.HasKey("NotificationId"); @@ -2436,19 +2482,17 @@ namespace ERPCore.Migrations modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => { b.Property("NotificationConfigId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UpdatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("NotificationConfigId"); @@ -2456,7 +2500,7 @@ namespace ERPCore.Migrations b.ToTable("notification_config", null, t => { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); + t.HasCheckConstraint("ck_notification_config_singleton", "`NotificationConfigId` = 1"); }); }); @@ -2464,31 +2508,31 @@ namespace ERPCore.Migrations { b.Property("NotificationConfigModuleId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("NotificationConfigModuleId")); b.Property("EmailEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.Property("InAppEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.Property("ModuleKey") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("NotificationConfigId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SmsEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.HasKey("NotificationConfigModuleId"); @@ -2505,21 +2549,21 @@ namespace ERPCore.Migrations { b.Property("NotificationRecipientId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("NotificationRecipientId")); b.Property("IsRead") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("NotificationId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("NotificationRecipientId"); @@ -2534,26 +2578,26 @@ namespace ERPCore.Migrations { b.Property("SequenceId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SequenceId")); b.Property("BranchId") - .HasColumnType("integer") + .HasColumnType("int") .HasColumnName("branch_id"); b.Property("DocType") .IsRequired() .HasMaxLength(10) - .HasColumnType("character varying(10)") + .HasColumnType("varchar(10)") .HasColumnName("doc_type"); b.Property("LastNumber") - .HasColumnType("integer") + .HasColumnType("int") .HasColumnName("last_number"); b.Property("Year") - .HasColumnType("integer") + .HasColumnType("int") .HasColumnName("year"); b.HasKey("SequenceId"); @@ -2570,78 +2614,89 @@ namespace ERPCore.Migrations { b.Property("PayrollLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PayrollLineId")); b.Property("AbsentDays") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("LateMinutesTotal") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LeaveDays") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("OtMinutesTotal") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("PayrollRunId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PresentDays") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("WorkingDays") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("PayrollLineId"); @@ -2657,32 +2712,32 @@ namespace ERPCore.Migrations { b.Property("PayrollLineComponentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PayrollLineComponentId")); b.Property("Amount") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("ComponentCategory") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Label") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("PayrollLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SalaryComponentId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SortOrder") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("PayrollLineComponentId"); @@ -2697,62 +2752,60 @@ namespace ERPCore.Migrations { b.Property("PayrollRunId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PayrollRunId")); b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ApprovedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("GeneratedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("LockedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PeriodMonth") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PeriodYear") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("UnlockReason") .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UnlockedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("PayrollRunId"); @@ -2772,43 +2825,41 @@ namespace ERPCore.Migrations { b.Property("PayrollStatutorySettingId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PayrollStatutorySettingId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EpfEmployeeRate") .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); + .HasColumnType("decimal(6,4)"); b.Property("EpfEmployerRate") .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); + .HasColumnType("decimal(6,4)"); b.Property("EtfEmployerRate") .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); + .HasColumnType("decimal(6,4)"); b.Property("OtMultiplierDefault") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.HasKey("PayrollStatutorySettingId"); @@ -2821,21 +2872,21 @@ namespace ERPCore.Migrations { b.Property("PayslipId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PayslipId")); b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("PayrollLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ReleasedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("PayslipId"); @@ -2849,20 +2900,20 @@ namespace ERPCore.Migrations { b.Property("PermissionId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PermissionId")); b.Property("Code") .IsRequired() .HasMaxLength(80) - .HasColumnType("character varying(80)"); + .HasColumnType("varchar(80)"); b.Property("NavItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SubNavItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("PermissionId"); @@ -3200,34 +3251,34 @@ namespace ERPCore.Migrations { b.Property("PoLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PoLineId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PoId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("QtyReceived") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("Tax") .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); + .HasColumnType("decimal(9,4)"); b.Property("UnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("PoLineId"); @@ -3243,58 +3294,66 @@ namespace ERPCore.Migrations modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => { b.Property("ConfigId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BatchListsEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("BrandsEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("CustomVariantsEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("CustomWarrantyPeriodsEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("ItemImagesEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.Property("ItemTypesEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SellingPricesEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("SerialNumbersEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("SubcategoriesEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UpdatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WarrantyPeriodsEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.HasKey("ConfigId"); @@ -3303,7 +3362,7 @@ namespace ERPCore.Migrations b.ToTable("product_config", null, t => { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); + t.HasCheckConstraint("ck_product_config_singleton", "`ConfigId` = 1"); }); }); @@ -3311,57 +3370,55 @@ namespace ERPCore.Migrations { b.Property("RunId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RunId")); b.Property("CancelReasonCodeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("OutputBinId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ReworkCount") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("ScaleFactor") .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); + .HasColumnType("decimal(18,6)"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("TargetQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("TemplateId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("RunId"); @@ -3387,43 +3444,41 @@ namespace ERPCore.Migrations { b.Property("TemplateId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TemplateId")); b.Property("Annotations") - .HasColumnType("jsonb"); + .HasColumnType("longtext"); b.Property("Code") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Description") .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("Name") .IsRequired() .HasMaxLength(150) - .HasColumnType("character varying(150)"); + .HasColumnType("varchar(150)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("TemplateId"); @@ -3441,86 +3496,84 @@ namespace ERPCore.Migrations { b.Property("PurchaseInvoiceId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PurchaseInvoiceId")); b.Property("BalanceAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("GrandTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("PaidAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Draft"); b.Property("Subtotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("VatTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("VendorId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("VendorInvoiceNo") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("VendorSnapshotName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("VendorSnapshotTaxNo") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.HasKey("PurchaseInvoiceId"); @@ -3544,27 +3597,27 @@ namespace ERPCore.Migrations { b.Property("PurchaseInvoiceLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PurchaseInvoiceLineId")); b.Property("GrnId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LineTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Subtotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("VatTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.HasKey("PurchaseInvoiceLineId"); @@ -3580,41 +3633,41 @@ namespace ERPCore.Migrations { b.Property("PurchaseInvoicePaymentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PurchaseInvoicePaymentId")); b.Property("Amount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("BankAccountName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("GlBankAccountId") .HasColumnType("bigint"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Reference") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.HasKey("PurchaseInvoicePaymentId"); @@ -3629,55 +3682,53 @@ namespace ERPCore.Migrations { b.Property("PoId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PoId")); b.Property("ApprovalRequired") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ApprovedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ApproverUserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("RequisitionId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("VendorId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("PoId"); @@ -3703,41 +3754,41 @@ namespace ERPCore.Migrations { b.Property("ReturnId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ReturnId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ReasonCodeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("VendorId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ReturnId"); @@ -3759,22 +3810,22 @@ namespace ERPCore.Migrations { b.Property("ReturnLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ReturnLineId")); b.Property("GrnLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ReturnId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ReturnLineId"); @@ -3791,24 +3842,24 @@ namespace ERPCore.Migrations { b.Property("ReasonCodeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ReasonCodeId")); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Context") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Description") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.HasKey("ReasonCodeId"); @@ -3822,28 +3873,28 @@ namespace ERPCore.Migrations { b.Property("RequisitionId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RequisitionId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("RequestedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("RequisitionId"); @@ -3863,22 +3914,22 @@ namespace ERPCore.Migrations { b.Property("ReqLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ReqLineId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RequiredBy") .HasColumnType("date"); b.Property("RequisitionId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ReqLineId"); @@ -3893,28 +3944,28 @@ namespace ERPCore.Migrations { b.Property("RfqId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RfqId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("RequisitionId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("RfqId"); @@ -3932,19 +3983,19 @@ namespace ERPCore.Migrations { b.Property("RfqLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RfqLineId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RfqId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("RfqLineId"); @@ -3959,47 +4010,45 @@ namespace ERPCore.Migrations { b.Property("RoleId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RoleId")); b.Property("AuthRoleId") - .HasColumnType("uuid") + .HasColumnType("char(36)") .HasColumnName("auth_role_id"); b.Property("Code") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("IsSystemRole") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("RoleId"); @@ -4015,14 +4064,14 @@ namespace ERPCore.Migrations modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => { b.Property("RoleId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PermissionId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Actions") .ValueGeneratedOnAdd() - .HasColumnType("integer") + .HasColumnType("int") .HasDefaultValue(31); b.HasKey("RoleId", "PermissionId"); @@ -4036,18 +4085,18 @@ namespace ERPCore.Migrations { b.Property("RunEdgeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RunEdgeId")); b.Property("ChildRunStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ParentRunStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RunId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("RunEdgeId"); @@ -4065,59 +4114,57 @@ namespace ERPCore.Migrations { b.Property("RunStageId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RunStageId")); b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EstimatedMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("FieldDefs") .IsRequired() - .HasColumnType("jsonb"); + .HasColumnType("longtext"); b.Property("FieldValues") - .HasColumnType("jsonb"); + .HasColumnType("longtext"); b.Property("Name") .IsRequired() .HasMaxLength(150) - .HasColumnType("character varying(150)"); + .HasColumnType("varchar(150)"); b.Property("PosX") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("PosY") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RoleLabel") .HasMaxLength(60) - .HasColumnType("character varying(60)"); + .HasColumnType("varchar(60)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("RunId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("TemplateStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("RunStageId"); @@ -4132,33 +4179,33 @@ namespace ERPCore.Migrations { b.Property("EventId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EventId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EventType") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Note") .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("Payload") - .HasColumnType("jsonb"); + .HasColumnType("longtext"); b.Property("RunId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RunStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("UserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("EventId"); @@ -4175,52 +4222,52 @@ namespace ERPCore.Migrations { b.Property("RunInputId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RunInputId")); b.Property("ConsumedQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ConsumedValue") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("DeliveredQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("FromRunOutputId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PlannedQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("QtyUnit") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("ReturnedQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ReturnedValue") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RunStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Source") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("RunInputId"); @@ -4237,42 +4284,42 @@ namespace ERPCore.Migrations { b.Property("RunOutputId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RunOutputId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Name") .IsRequired() .HasMaxLength(150) - .HasColumnType("character varying(150)"); + .HasColumnType("varchar(150)"); b.Property("PlannedQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ProducedQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RunStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ScrappedQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("TransferredQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("UomId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("RunOutputId"); @@ -4291,49 +4338,47 @@ namespace ERPCore.Migrations { b.Property("SalaryComponentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SalaryComponentId")); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("ComponentType") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("IsTaxable") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("SalaryComponentId"); @@ -4348,45 +4393,48 @@ namespace ERPCore.Migrations modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => { b.Property("ConfigId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("AllowCashCustomer") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); + b.Property("AllowDiscounts") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + b.Property("AllowFreeItems") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("AllowOverStockSale") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.Property("AllowWarehouseSelection") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("CashCustomerId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DefaultWarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UpdatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ConfigId"); @@ -4406,75 +4454,73 @@ namespace ERPCore.Migrations { b.Property("SalesDayEndId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SalesDayEndId")); b.Property("BalanceTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("BundleCount") .ValueGeneratedOnAdd() - .HasColumnType("integer") + .HasColumnType("int") .HasDefaultValue(0); b.Property("BusinessDate") .HasColumnType("date"); b.Property("CashierUserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ClosedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CostOfGoodsSold") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("DiscountTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("GrandTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("PaidTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SlipCount") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Subtotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("TaxTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.HasKey("SalesDayEndId"); @@ -4493,106 +4539,104 @@ namespace ERPCore.Migrations { b.Property("SalesInvoiceId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SalesInvoiceId")); b.Property("BalanceAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatorUserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CustomerId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CustomerSnapshotName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("CustomerSnapshotTaxNo") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("DiscountTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("GrandTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("InvoiceNo") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("InvoiceType") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("B2C"); b.Property("NetPayable") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("PaidAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RoundOff") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Draft"); b.Property("Subtotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("TaxTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("SalesInvoiceId"); @@ -4618,83 +4662,81 @@ namespace ERPCore.Migrations { b.Property("SalesInvoiceLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SalesInvoiceLineId")); b.Property("BaseCost") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("Description") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("DiscountAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("DiscountMode") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DiscountPct") .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); + .HasColumnType("decimal(9,4)"); b.Property("FreeQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("IsFreeIssue") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LineTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("NetUnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ParentLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PriceSource") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SalesInvoiceId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("TaxAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("TaxPct") .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); + .HasColumnType("decimal(9,4)"); b.Property("UnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("SalesInvoiceLineId"); @@ -4711,41 +4753,41 @@ namespace ERPCore.Migrations { b.Property("SalesInvoicePaymentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SalesInvoicePaymentId")); b.Property("Amount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("BankAccountName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("GlBankAccountId") .HasColumnType("bigint"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Reference") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("SalesInvoiceId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("SalesInvoicePaymentId"); @@ -4760,41 +4802,41 @@ namespace ERPCore.Migrations { b.Property("ReturnId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ReturnId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CustomerId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ReasonCodeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ReturnId"); @@ -4816,22 +4858,22 @@ namespace ERPCore.Migrations { b.Property("ReturnLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ReturnLineId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ReturnId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ReturnLineId"); @@ -4848,77 +4890,75 @@ namespace ERPCore.Migrations { b.Property("SalesSlipId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SalesSlipId")); b.Property("BalanceAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("CashierUserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CustomerId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CustomerSnapshotName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("DayEndId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DiscountTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("GrandTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("PaidAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("SlipNo") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Draft"); b.Property("Subtotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("TaxTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("SalesSlipId"); @@ -4944,89 +4984,87 @@ namespace ERPCore.Migrations { b.Property("SalesSlipLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SalesSlipLineId")); b.Property("BaseCost") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("BatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Description") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("DiscountAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("DiscountMode") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DiscountPct") .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); + .HasColumnType("decimal(9,4)"); b.Property("FreeQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("IsFreeIssue") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LineTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("NetUnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ParentLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PriceSource") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SalesSlipId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SerialId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("TaxAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("TaxPct") .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); + .HasColumnType("decimal(9,4)"); b.Property("UnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("SalesSlipLineId"); @@ -5047,26 +5085,26 @@ namespace ERPCore.Migrations { b.Property("SerialId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SerialId")); b.Property("Barcode") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SerialNo") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("SerialId"); @@ -5083,18 +5121,18 @@ namespace ERPCore.Migrations { b.Property("EdgeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EdgeId")); b.Property("ChildStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ParentStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("TemplateId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("EdgeId"); @@ -5112,32 +5150,32 @@ namespace ERPCore.Migrations { b.Property("InputId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("InputId")); b.Property("FromOutputId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("QtyPerBatch") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("QtyUnit") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Source") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("StageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("InputId"); @@ -5154,27 +5192,27 @@ namespace ERPCore.Migrations { b.Property("OutputId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OutputId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Name") .IsRequired() .HasMaxLength(150) - .HasColumnType("character varying(150)"); + .HasColumnType("varchar(150)"); b.Property("QtyPerBatch") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("StageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("UomId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("OutputId"); @@ -5191,47 +5229,45 @@ namespace ERPCore.Migrations { b.Property("AdjustmentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("AdjustmentId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ReasonCodeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("AdjustmentId"); @@ -5253,28 +5289,28 @@ namespace ERPCore.Migrations { b.Property("AdjLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("AdjLineId")); b.Property("AdjustmentId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BinId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("QtyDelta") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("SerialId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("AdjLineId"); @@ -5295,42 +5331,40 @@ namespace ERPCore.Migrations { b.Property("CountId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CountId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CountType") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("CountId"); @@ -5352,36 +5386,36 @@ namespace ERPCore.Migrations { b.Property("CountLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CountLineId")); b.Property("BatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BinId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CountId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CountedQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SerialId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SystemQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("Variance") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.HasKey("CountLineId"); @@ -5402,39 +5436,39 @@ namespace ERPCore.Migrations { b.Property("LayerId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("LayerId")); b.Property("BatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("GrnLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("QtyReceived") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("QtyRemaining") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("SerialId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("UnitCost") .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); + .HasColumnType("decimal(18,6)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("LayerId"); @@ -5455,59 +5489,59 @@ namespace ERPCore.Migrations { b.Property("LedgerId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("LedgerId")); b.Property("BatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BinId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Direction") .IsRequired() .HasMaxLength(5) - .HasColumnType("character varying(5)"); + .HasColumnType("varchar(5)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("QtyBase") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RunningBalance") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("SerialId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SourceDocId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SourceDocType") .IsRequired() .HasMaxLength(10) - .HasColumnType("character varying(10)"); + .HasColumnType("varchar(10)"); b.Property("UnitCost") .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); + .HasColumnType("decimal(18,6)"); b.Property("UserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Value") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("LedgerId"); @@ -5534,40 +5568,38 @@ namespace ERPCore.Migrations { b.Property("TransferId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TransferId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DestWarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SrcWarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("TransferId"); @@ -5591,39 +5623,39 @@ namespace ERPCore.Migrations { b.Property("TransferLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TransferLineId")); b.Property("BatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DestBinId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("QtyReceived") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("SerialId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SrcBinId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("TransferId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("UnitCost") .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); + .HasColumnType("decimal(18,6)"); b.HasKey("TransferLineId"); @@ -5646,36 +5678,34 @@ namespace ERPCore.Migrations { b.Property("SubCategoryId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SubCategoryId")); b.Property("CategoryId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("SubCategoryId"); @@ -5691,39 +5721,39 @@ namespace ERPCore.Migrations { b.Property("SubNavItemId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SubNavItemId")); b.Property("Code") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Href") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("Icon") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Label") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("NavItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SortOrder") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.HasKey("SubNavItemId"); @@ -6162,37 +6192,35 @@ namespace ERPCore.Migrations { b.Property("TicketId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TicketId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Subject") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UpdatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("TicketId"); @@ -6207,26 +6235,26 @@ namespace ERPCore.Migrations { b.Property("MessageId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("MessageId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("IsFromAdmin") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("Message") .IsRequired() .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); + .HasColumnType("varchar(2000)"); b.Property("SenderUserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("TicketId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("MessageId"); @@ -6239,42 +6267,40 @@ namespace ERPCore.Migrations { b.Property("TaxRateId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TaxRateId")); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("Percentage") .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); + .HasColumnType("decimal(5,2)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("TaxRateId"); @@ -6293,7 +6319,7 @@ namespace ERPCore.Migrations CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), Name = "Standard", Percentage = 15m, - RowVersion = 0u, + RowVersion = 1u, Status = "Active" }, new @@ -6303,7 +6329,7 @@ namespace ERPCore.Migrations CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), Name = "Zero-Rated", Percentage = 0m, - RowVersion = 0u, + RowVersion = 1u, Status = "Active" }, new @@ -6313,7 +6339,7 @@ namespace ERPCore.Migrations CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), Name = "Exempt", Percentage = 0m, - RowVersion = 0u, + RowVersion = 1u, Status = "Active" }); }); @@ -6322,36 +6348,34 @@ namespace ERPCore.Migrations { b.Property("TaxSlabId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TaxSlabId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("LowerBound") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("Rate") .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); + .HasColumnType("decimal(6,4)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("UpperBound") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.HasKey("TaxSlabId"); @@ -6364,36 +6388,36 @@ namespace ERPCore.Migrations { b.Property("StageId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("StageId")); b.Property("EstimatedMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("FieldDefs") .IsRequired() - .HasColumnType("jsonb"); + .HasColumnType("longtext"); b.Property("Name") .IsRequired() .HasMaxLength(150) - .HasColumnType("character varying(150)"); + .HasColumnType("varchar(150)"); b.Property("PosX") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("PosY") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RoleLabel") .HasMaxLength(60) - .HasColumnType("character varying(60)"); + .HasColumnType("varchar(60)"); b.Property("TemplateId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("StageId"); @@ -6406,27 +6430,27 @@ namespace ERPCore.Migrations { b.Property("UomId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("UomId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("UomId"); @@ -6442,35 +6466,35 @@ namespace ERPCore.Migrations { b.Property("UserId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("UserId")); b.Property("AuthUserId") - .HasColumnType("uuid") + .HasColumnType("char(36)") .HasColumnName("auth_user_id"); b.Property("DisplayName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("Email") .HasMaxLength(320) - .HasColumnType("character varying(320)"); + .HasColumnType("varchar(320)"); b.Property("RoleId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Username") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.HasKey("UserId"); @@ -6501,56 +6525,54 @@ namespace ERPCore.Migrations { b.Property("VendorId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("VendorId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Code") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Currency") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(3) - .HasColumnType("character varying(3)") + .HasColumnType("varchar(3)") .HasDefaultValue("LKR"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("TaxReg") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Terms") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("VendorId"); @@ -6568,18 +6590,18 @@ namespace ERPCore.Migrations { b.Property("QuotationId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("QuotationId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("RfqId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("VendorId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("QuotationId"); @@ -6595,22 +6617,22 @@ namespace ERPCore.Migrations { b.Property("QuotationLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("QuotationLineId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LeadDays") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("QuotationId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("UnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.HasKey("QuotationLineId"); @@ -6625,28 +6647,28 @@ namespace ERPCore.Migrations { b.Property("WarehouseId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("WarehouseId")); b.Property("Address") - .HasColumnType("text"); + .HasColumnType("longtext"); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Code") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("Phone") - .HasColumnType("text"); + .HasColumnType("longtext"); b.HasKey("WarehouseId"); @@ -6658,67 +6680,102 @@ namespace ERPCore.Migrations b.ToTable("warehouses", (string)null); }); - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => + modelBuilder.Entity("ERPCore.Domain.Entities.WarrantyPeriod", b => { - b.Property("WorkShiftId") + b.Property("WarrantyPeriodId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("WarrantyPeriodId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); + b.Property("Months") + .HasColumnType("int"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); + + b.HasKey("WarrantyPeriodId"); + + b.HasIndex("Months") + .IsUnique(); + + b.HasIndex("Status"); + + b.ToTable("warranty_periods", null, t => + { + t.HasCheckConstraint("ck_warranty_periods_months", "\"Months\" BETWEEN 1 AND 600"); + }); + }); + + modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => + { + b.Property("WorkShiftId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("WorkShiftId")); + + b.Property("BreakMinutes") + .HasColumnType("int"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("varchar(20)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("GraceMinutes") + .HasColumnType("int"); + + b.Property("IsOvernight") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("OtMultiplier") + .HasPrecision(6, 2) + .HasColumnType("decimal(6,2)"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .HasColumnType("int unsigned"); + + b.Property("StandardWorkingMinutes") + .HasColumnType("int"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("Status") + .IsRequired() + .ValueGeneratedOnAdd() + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasDefaultValue("Active"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); b.Property("WorkingDaysMask") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("WorkShiftId"); @@ -7112,6 +7169,23 @@ namespace ERPCore.Migrations b.Navigation("Warehouse"); }); + modelBuilder.Entity("ERPCore.Domain.Entities.GrnConfig", b => + { + b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") + .WithMany() + .HasForeignKey("DefaultWarehouseId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") + .WithMany() + .HasForeignKey("UpdatedBy") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("DefaultWarehouse"); + + b.Navigation("UpdatedByUser"); + }); + modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => { b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") @@ -7210,6 +7284,17 @@ namespace ERPCore.Migrations b.Navigation("TaxRate"); }); + modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => + { + b.HasOne("ERPCore.Domain.Entities.Item", "Item") + .WithMany() + .HasForeignKey("ItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Item"); + }); + modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => { b.HasOne("ERPCore.Domain.Entities.Item", "Item") diff --git a/Backend/ERPCore/Migrations/20261005111955_AddSalesGrnConfigItemImagesWarrantyPeriods.cs b/Backend/ERPCore/Migrations/20261005111955_AddSalesGrnConfigItemImagesWarrantyPeriods.cs new file mode 100644 index 0000000..ef5a27d --- /dev/null +++ b/Backend/ERPCore/Migrations/20261005111955_AddSalesGrnConfigItemImagesWarrantyPeriods.cs @@ -0,0 +1,225 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace ERPCore.Migrations +{ + /// + public partial class AddSalesGrnConfigItemImagesWarrantyPeriods : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "CustomVariantsEnabled", + table: "product_config", + type: "tinyint(1)", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "CustomWarrantyPeriodsEnabled", + table: "product_config", + type: "tinyint(1)", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ItemImagesEnabled", + table: "product_config", + type: "tinyint(1)", + nullable: false, + defaultValue: false); + + migrationBuilder.CreateTable( + name: "grn_config", + columns: table => new + { + ConfigId = table.Column(type: "int", nullable: false), + AllowWarehouseSelection = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), + DefaultWarehouseId = table.Column(type: "int", nullable: true), + AllowDiscounts = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), + AllowVat = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + UpdatedBy = table.Column(type: "int", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_grn_config", x => x.ConfigId); + table.CheckConstraint("ck_grn_config_singleton", "\"ConfigId\" = 1"); + table.ForeignKey( + name: "FK_grn_config_users_UpdatedBy", + column: x => x.UpdatedBy, + principalTable: "users", + principalColumn: "UserId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_grn_config_warehouses_DefaultWarehouseId", + column: x => x.DefaultWarehouseId, + principalTable: "warehouses", + principalColumn: "WarehouseId", + onDelete: ReferentialAction.SetNull); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "item_images", + columns: table => new + { + ItemImageId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ItemId = table.Column(type: "int", nullable: false), + OriginalFileName = table.Column(type: "varchar(260)", maxLength: 260, nullable: false, collation: "utf8mb4_unicode_ci"), + StoredFileName = table.Column(type: "varchar(260)", maxLength: 260, nullable: false, collation: "utf8mb4_unicode_ci"), + RelativePath = table.Column(type: "varchar(500)", maxLength: 500, nullable: false, collation: "utf8mb4_unicode_ci"), + ContentType = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, collation: "utf8mb4_unicode_ci"), + SizeBytes = table.Column(type: "bigint", nullable: false), + SortOrder = table.Column(type: "int", nullable: false), + UploadedBy = table.Column(type: "int", nullable: false), + UploadedAt = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_item_images", x => x.ItemImageId); + table.ForeignKey( + name: "FK_item_images_items_ItemId", + column: x => x.ItemId, + principalTable: "items", + principalColumn: "ItemId", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "sales_config", + columns: table => new + { + ConfigId = table.Column(type: "int", nullable: false), + AllowCashCustomer = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false), + CashCustomerId = table.Column(type: "int", nullable: true), + AllowFreeItems = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), + AllowDiscounts = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), + AllowOverStockSale = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false), + AllowWarehouseSelection = table.Column(type: "tinyint(1)", nullable: false, defaultValue: true), + DefaultWarehouseId = table.Column(type: "int", nullable: true), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true), + UpdatedBy = table.Column(type: "int", nullable: true), + RowVersion = table.Column(type: "int unsigned", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_sales_config", x => x.ConfigId); + table.CheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); + table.ForeignKey( + name: "FK_sales_config_customers_CashCustomerId", + column: x => x.CashCustomerId, + principalTable: "customers", + principalColumn: "CustomerId", + onDelete: ReferentialAction.SetNull); + table.ForeignKey( + name: "FK_sales_config_users_UpdatedBy", + column: x => x.UpdatedBy, + principalTable: "users", + principalColumn: "UserId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_sales_config_warehouses_DefaultWarehouseId", + column: x => x.DefaultWarehouseId, + principalTable: "warehouses", + principalColumn: "WarehouseId", + onDelete: ReferentialAction.SetNull); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateTable( + name: "warranty_periods", + columns: table => new + { + WarrantyPeriodId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Months = table.Column(type: "int", nullable: false), + Status = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, defaultValue: "Active", collation: "utf8mb4_unicode_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_warranty_periods", x => x.WarrantyPeriodId); + table.CheckConstraint("ck_warranty_periods_months", "\"Months\" BETWEEN 1 AND 600"); + }) + .Annotation("Relational:Collation", "utf8mb4_unicode_ci"); + + migrationBuilder.CreateIndex( + name: "IX_grn_config_DefaultWarehouseId", + table: "grn_config", + column: "DefaultWarehouseId"); + + migrationBuilder.CreateIndex( + name: "IX_grn_config_UpdatedBy", + table: "grn_config", + column: "UpdatedBy"); + + migrationBuilder.CreateIndex( + name: "IX_item_images_ItemId_SortOrder", + table: "item_images", + columns: new[] { "ItemId", "SortOrder" }); + + migrationBuilder.CreateIndex( + name: "IX_sales_config_CashCustomerId", + table: "sales_config", + column: "CashCustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_sales_config_DefaultWarehouseId", + table: "sales_config", + column: "DefaultWarehouseId"); + + migrationBuilder.CreateIndex( + name: "IX_sales_config_UpdatedBy", + table: "sales_config", + column: "UpdatedBy"); + + migrationBuilder.CreateIndex( + name: "IX_warranty_periods_Months", + table: "warranty_periods", + column: "Months", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_warranty_periods_Status", + table: "warranty_periods", + column: "Status"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "grn_config"); + + migrationBuilder.DropTable( + name: "item_images"); + + migrationBuilder.DropTable( + name: "sales_config"); + + migrationBuilder.DropTable( + name: "warranty_periods"); + + migrationBuilder.DropColumn( + name: "CustomVariantsEnabled", + table: "product_config"); + + migrationBuilder.DropColumn( + name: "CustomWarrantyPeriodsEnabled", + table: "product_config"); + + migrationBuilder.DropColumn( + name: "ItemImagesEnabled", + table: "product_config"); + } + } +} diff --git a/Backend/ERPCore/Migrations/ErpDbContextModelSnapshot.cs b/Backend/ERPCore/Migrations/ErpDbContextModelSnapshot.cs index 6a5265c..7aa17b5 100644 --- a/Backend/ERPCore/Migrations/ErpDbContextModelSnapshot.cs +++ b/Backend/ERPCore/Migrations/ErpDbContextModelSnapshot.cs @@ -3,8 +3,8 @@ using System; using ERPCore.Infra.Persistence; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable @@ -17,80 +17,79 @@ namespace ERPCore.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); + .UseCollation("utf8mb4_unicode_ci") + .HasAnnotation("ProductVersion", "9.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 64); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => { b.Property("AttendanceRecordId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("AttendanceRecordId")); b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("AttendanceStatus") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CheckIn") - .HasColumnType("interval"); + .HasColumnType("time(6)"); b.Property("CheckOut") - .HasColumnType("interval"); + .HasColumnType("time(6)"); b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EditedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("IsManualOverride") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("LateMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Notes") .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); + .HasColumnType("varchar(1000)"); b.Property("OvertimeMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowValidationStatus") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("WorkShiftId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WorkingMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("AttendanceRecordId"); @@ -107,61 +106,59 @@ namespace ERPCore.Migrations { b.Property("AttendanceUploadBatchId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("AttendanceUploadBatchId")); b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ConfirmedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("OriginalFileName") .HasMaxLength(260) - .HasColumnType("character varying(260)"); + .HasColumnType("varchar(260)"); b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("RowCountDuplicate") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowCountError") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowCountTotal") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SourceType") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UploadedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("AttendanceUploadBatchId"); @@ -179,32 +176,32 @@ namespace ERPCore.Migrations { b.Property("AuditId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("AuditId")); b.Property("Action") .IsRequired() .HasMaxLength(10) - .HasColumnType("character varying(10)"); + .HasColumnType("varchar(10)"); b.Property("ChangeSet") .IsRequired() - .HasColumnType("jsonb"); + .HasColumnType("longtext"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EntityId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EntityType") .IsRequired() .HasMaxLength(80) - .HasColumnType("character varying(80)"); + .HasColumnType("varchar(80)"); b.Property("UserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("AuditId"); @@ -221,24 +218,24 @@ namespace ERPCore.Migrations { b.Property("BatchId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BatchId")); b.Property("Barcode") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("BatchNo") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("ExpiryDate") .HasColumnType("date"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("BatchId"); @@ -255,21 +252,21 @@ namespace ERPCore.Migrations { b.Property("BinId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BinId")); b.Property("BinType") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Code") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("BinId"); @@ -283,46 +280,44 @@ namespace ERPCore.Migrations { b.Property("BranchId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BranchId")); b.Property("Address") .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("PhoneNumber") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("BranchId"); @@ -337,27 +332,25 @@ namespace ERPCore.Migrations modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => { b.Property("ConfigId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BranchingEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UpdatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.HasKey("ConfigId"); @@ -365,7 +358,7 @@ namespace ERPCore.Migrations b.ToTable("branch_config", null, t => { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); + t.HasCheckConstraint("ck_branch_config_singleton", "`ConfigId` = 1"); }); }); @@ -373,33 +366,31 @@ namespace ERPCore.Migrations { b.Property("BrandId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BrandId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("BrandId"); @@ -415,90 +406,88 @@ namespace ERPCore.Migrations { b.Property("BundleSaleId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BundleSaleId")); b.Property("BundleCode") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("BundleName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("BundleNo") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("BundlePrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CashierUserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ComponentSubtotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); + .HasColumnType("decimal(18,4)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CustomerId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CustomerSnapshotName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("DayEndId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DiscountTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("GrandTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("MarginAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Draft"); b.Property("TaxTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("BundleSaleId"); @@ -522,48 +511,48 @@ namespace ERPCore.Migrations { b.Property("BundleSaleLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BundleSaleLineId")); b.Property("BundleSaleId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Description") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("IncludeInBundle") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("IsComponent") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LineTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ParentLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("UnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("BundleSaleLineId"); @@ -580,42 +569,40 @@ namespace ERPCore.Migrations { b.Property("BundleSaleTemplateId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BundleSaleTemplateId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Description") .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); + .HasColumnType("varchar(1000)"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("TemplateCode") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("TemplateName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("BundleSaleTemplateId"); @@ -629,34 +616,34 @@ namespace ERPCore.Migrations { b.Property("BundleSaleTemplateLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("BundleSaleTemplateLineId")); b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("IncludeInBundle") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("SortOrder") .ValueGeneratedOnAdd() - .HasColumnType("integer") + .HasColumnType("int") .HasDefaultValue(0); b.Property("UnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("BundleSaleTemplateLineId"); @@ -673,33 +660,31 @@ namespace ERPCore.Migrations { b.Property("CategoryId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CategoryId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("CategoryId"); @@ -715,90 +700,88 @@ namespace ERPCore.Migrations { b.Property("CustomerId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CustomerId")); b.Property("AddressLine1") .HasMaxLength(250) - .HasColumnType("character varying(250)"); + .HasColumnType("varchar(250)"); b.Property("AddressLine2") .HasMaxLength(250) - .HasColumnType("character varying(250)"); + .HasColumnType("varchar(250)"); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("City") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("Country") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreditDays") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreditLimit") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("CustomerCode") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("CustomerType") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("B2C"); b.Property("DefaultWarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DisplayName") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("Email") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("Phone") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("TaxRegistrationNo") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("CustomerId"); @@ -820,47 +803,45 @@ namespace ERPCore.Migrations { b.Property("DepartmentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("DepartmentId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("HeadEmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("ParentDepartmentId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("DepartmentId"); @@ -882,38 +863,36 @@ namespace ERPCore.Migrations { b.Property("DesignationId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("DesignationId")); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("DesignationId"); @@ -929,145 +908,143 @@ namespace ERPCore.Migrations { b.Property("EmployeeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EmployeeId")); b.Property("AddressLine1") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("AddressLine2") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("City") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Country") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("DepartmentId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DesignationId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Email") .HasMaxLength(320) - .HasColumnType("character varying(320)"); + .HasColumnType("varchar(320)"); b.Property("EmergencyContactName") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("EmergencyContactPhone") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("EmergencyContactRelationship") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("EmployeeCode") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("EmploymentTypeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EpfNumber") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("EtfNumber") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("FullName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("Gender") .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("HireDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Nationality") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("Nic") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("PersonalMobile") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("PostalCode") .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("ProfilePhotoPath") .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("ReportingManagerId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("TaxIdentificationNumber") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UpdatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("UserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WorkShiftId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("EmployeeId"); @@ -1100,58 +1077,56 @@ namespace ERPCore.Migrations { b.Property("EmployeeBankDetailId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EmployeeBankDetailId")); b.Property("AccountHolderName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("AccountNumber") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("BankName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("BranchName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("IsPrimary") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("SwiftCode") .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("EmployeeBankDetailId"); @@ -1164,46 +1139,44 @@ namespace ERPCore.Migrations { b.Property("EmployeeDocumentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EmployeeDocumentId")); b.Property("ContentType") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("HrDocumentTypeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Notes") .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); + .HasColumnType("varchar(1000)"); b.Property("OriginalFileName") .IsRequired() .HasMaxLength(260) - .HasColumnType("character varying(260)"); + .HasColumnType("varchar(260)"); b.Property("RelativePath") .IsRequired() .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SizeBytes") .HasColumnType("bigint"); @@ -1212,25 +1185,25 @@ namespace ERPCore.Migrations .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("StoredFileName") .IsRequired() .HasMaxLength(260) - .HasColumnType("character varying(260)"); + .HasColumnType("varchar(260)"); b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UploadedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("VerifiedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("EmployeeDocumentId"); @@ -1247,70 +1220,68 @@ namespace ERPCore.Migrations { b.Property("EmployeeLoanId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EmployeeLoanId")); b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ApprovedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("InstallmentAmount") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("InterestRate") .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); + .HasColumnType("decimal(6,4)"); b.Property("LoanKind") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("NumberOfInstallments") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("OutstandingBalance") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("PrincipalAmount") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("StartMonth") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("StartYear") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("EmployeeLoanId"); @@ -1328,50 +1299,48 @@ namespace ERPCore.Migrations { b.Property("EmployeeSalaryStructureId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EmployeeSalaryStructureId")); b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ApprovedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BasicSalary") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Currency") .IsRequired() .HasMaxLength(3) - .HasColumnType("character varying(3)"); + .HasColumnType("varchar(3)"); b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("EmployeeSalaryStructureId"); @@ -1384,19 +1353,19 @@ namespace ERPCore.Migrations { b.Property("EmployeeSalaryStructureLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EmployeeSalaryStructureLineId")); b.Property("Amount") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SalaryComponentId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("EmployeeSalaryStructureLineId"); @@ -1411,38 +1380,36 @@ namespace ERPCore.Migrations { b.Property("EmploymentTypeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EmploymentTypeId")); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("EmploymentTypeId"); @@ -1458,56 +1425,54 @@ namespace ERPCore.Migrations { b.Property("GrnId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("GrnId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("PoId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("VendorId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("GrnId"); @@ -1534,37 +1499,35 @@ namespace ERPCore.Migrations modelBuilder.Entity("ERPCore.Domain.Entities.GrnConfig", b => { b.Property("ConfigId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("AllowDiscounts") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("AllowVat") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("AllowWarehouseSelection") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("DefaultWarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UpdatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ConfigId"); @@ -1582,65 +1545,65 @@ namespace ERPCore.Migrations { b.Property("GrnLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("GrnLineId")); b.Property("BatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BinId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DiscountPct") .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); + .HasColumnType("decimal(9,4)"); b.Property("GrnId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("HoldStatus") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LineTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("NetUnitCost") .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); + .HasColumnType("decimal(18,6)"); b.Property("PoLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PoUnitPrice") .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); + .HasColumnType("decimal(18,6)"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ReceivedValue") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("UnitCost") .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); + .HasColumnType("decimal(18,6)"); b.Property("VatAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("VatPct") .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); + .HasColumnType("decimal(9,4)"); b.HasKey("GrnLineId"); @@ -1661,20 +1624,20 @@ namespace ERPCore.Migrations { b.Property("GrnLineWarrantyNumberId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("GrnLineWarrantyNumberId")); b.Property("GrnLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WarrantyNo") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("GrnLineWarrantyNumberId"); @@ -1688,49 +1651,47 @@ namespace ERPCore.Migrations { b.Property("HrDocumentTypeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("HrDocumentTypeId")); b.Property("Category") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ExpiryTracked") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("HrDocumentTypeId"); @@ -1746,112 +1707,110 @@ namespace ERPCore.Migrations { b.Property("ItemId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ItemId")); b.Property("Barcode") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("BaseUomId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BrandId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CategoryId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ContentBaseQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ContentBaseUnit") .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("ContentQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ContentUnit") .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("DefaultVendorId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Description") .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); + .HasColumnType("varchar(1000)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SellingFlatPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("SellingMaxPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("SellingMinPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("Sku") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("StockNature") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("SubCategoryId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("TaxRateId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("TrackingMode") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Warranty") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("NonWarranty"); b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ItemId"); @@ -1882,44 +1841,44 @@ namespace ERPCore.Migrations { b.Property("ItemImageId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemImageId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ItemImageId")); b.Property("ContentType") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("OriginalFileName") .IsRequired() .HasMaxLength(260) - .HasColumnType("character varying(260)"); + .HasColumnType("varchar(260)"); b.Property("RelativePath") .IsRequired() .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("SizeBytes") .HasColumnType("bigint"); b.Property("SortOrder") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("StoredFileName") .IsRequired() .HasMaxLength(260) - .HasColumnType("character varying(260)"); + .HasColumnType("varchar(260)"); b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UploadedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ItemImageId"); @@ -1932,23 +1891,23 @@ namespace ERPCore.Migrations { b.Property("ReorderId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ReorderId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ReorderPoint") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ReorderQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ReorderId"); @@ -1964,38 +1923,36 @@ namespace ERPCore.Migrations { b.Property("ItemTypeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ItemTypeId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("IsMeasurable") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("ItemTypeId"); @@ -2011,31 +1968,31 @@ namespace ERPCore.Migrations { b.Property("JournalId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JournalId")); b.Property("Amount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("CreditAccount") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("DebitAccount") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("SourceDocId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SourceDocType") .IsRequired() .HasMaxLength(10) - .HasColumnType("character varying(10)"); + .HasColumnType("varchar(10)"); b.HasKey("JournalId"); @@ -2048,43 +2005,41 @@ namespace ERPCore.Migrations { b.Property("LeaveBalanceId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("LeaveBalanceId")); b.Property("AdjustmentDays") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("CarriedForwardDays") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EntitledDays") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("LeaveTypeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("TakenDays") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Year") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("LeaveBalanceId"); @@ -2100,61 +2055,59 @@ namespace ERPCore.Migrations { b.Property("LeaveRequestId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("LeaveRequestId")); b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ApprovedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DaysCount") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EndDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("LeaveTypeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Reason") .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); + .HasColumnType("varchar(1000)"); b.Property("RejectionReason") .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); + .HasColumnType("varchar(1000)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("StartDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("LeaveRequestId"); @@ -2176,57 +2129,55 @@ namespace ERPCore.Migrations { b.Property("LeaveTypeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("LeaveTypeId")); b.Property("AccrualPerYear") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CountsAsNoPay") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("IsPaid") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RequiresApproval") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("LeaveTypeId"); @@ -2242,43 +2193,41 @@ namespace ERPCore.Migrations { b.Property("LoanInstallmentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("LoanInstallmentId")); b.Property("DueMonth") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DueYear") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EmployeeLoanId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("InstallmentNumber") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PaidAmount") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("PayrollRunId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("ScheduledAmount") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("LoanInstallmentId"); @@ -2295,27 +2244,27 @@ namespace ERPCore.Migrations { b.Property("LoginActivityId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("LoginActivityId")); b.Property("DeviceLabel") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("IpAddress") .HasMaxLength(64) - .HasColumnType("character varying(64)"); + .HasColumnType("varchar(64)"); b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UserAgent") .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("UserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("LoginActivityId"); @@ -2328,36 +2277,36 @@ namespace ERPCore.Migrations { b.Property("NavItemId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("NavItemId")); b.Property("Code") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Href") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("Icon") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Label") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("SortOrder") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.HasKey("NavItemId"); @@ -2491,34 +2440,34 @@ namespace ERPCore.Migrations { b.Property("NotificationId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("NotificationId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Message") .IsRequired() .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); + .HasColumnType("varchar(1000)"); b.Property("ModuleKey") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("RelatedEntityId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RelatedEntityType") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("Title") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.HasKey("NotificationId"); @@ -2530,19 +2479,17 @@ namespace ERPCore.Migrations modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => { b.Property("NotificationConfigId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UpdatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("NotificationConfigId"); @@ -2550,7 +2497,7 @@ namespace ERPCore.Migrations b.ToTable("notification_config", null, t => { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); + t.HasCheckConstraint("ck_notification_config_singleton", "`NotificationConfigId` = 1"); }); }); @@ -2558,31 +2505,31 @@ namespace ERPCore.Migrations { b.Property("NotificationConfigModuleId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("NotificationConfigModuleId")); b.Property("EmailEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.Property("InAppEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.Property("ModuleKey") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("NotificationConfigId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SmsEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.HasKey("NotificationConfigModuleId"); @@ -2599,21 +2546,21 @@ namespace ERPCore.Migrations { b.Property("NotificationRecipientId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("NotificationRecipientId")); b.Property("IsRead") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("NotificationId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("NotificationRecipientId"); @@ -2628,26 +2575,26 @@ namespace ERPCore.Migrations { b.Property("SequenceId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SequenceId")); b.Property("BranchId") - .HasColumnType("integer") + .HasColumnType("int") .HasColumnName("branch_id"); b.Property("DocType") .IsRequired() .HasMaxLength(10) - .HasColumnType("character varying(10)") + .HasColumnType("varchar(10)") .HasColumnName("doc_type"); b.Property("LastNumber") - .HasColumnType("integer") + .HasColumnType("int") .HasColumnName("last_number"); b.Property("Year") - .HasColumnType("integer") + .HasColumnType("int") .HasColumnName("year"); b.HasKey("SequenceId"); @@ -2664,78 +2611,89 @@ namespace ERPCore.Migrations { b.Property("PayrollLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PayrollLineId")); b.Property("AbsentDays") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("EmployeeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("LateMinutesTotal") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LeaveDays") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("OtMinutesTotal") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("PayrollRunId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PresentDays") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); b.Property("WorkingDays") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("PayrollLineId"); @@ -2751,32 +2709,32 @@ namespace ERPCore.Migrations { b.Property("PayrollLineComponentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PayrollLineComponentId")); b.Property("Amount") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("ComponentCategory") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Label") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("PayrollLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SalaryComponentId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SortOrder") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("PayrollLineComponentId"); @@ -2791,62 +2749,60 @@ namespace ERPCore.Migrations { b.Property("PayrollRunId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PayrollRunId")); b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ApprovedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("GeneratedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("LockedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PeriodMonth") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PeriodYear") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("UnlockReason") .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UnlockedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("PayrollRunId"); @@ -2866,43 +2822,41 @@ namespace ERPCore.Migrations { b.Property("PayrollStatutorySettingId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PayrollStatutorySettingId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EpfEmployeeRate") .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); + .HasColumnType("decimal(6,4)"); b.Property("EpfEmployerRate") .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); + .HasColumnType("decimal(6,4)"); b.Property("EtfEmployerRate") .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); + .HasColumnType("decimal(6,4)"); b.Property("OtMultiplierDefault") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.HasKey("PayrollStatutorySettingId"); @@ -2915,21 +2869,21 @@ namespace ERPCore.Migrations { b.Property("PayslipId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PayslipId")); b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("PayrollLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ReleasedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("PayslipId"); @@ -2943,20 +2897,20 @@ namespace ERPCore.Migrations { b.Property("PermissionId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PermissionId")); b.Property("Code") .IsRequired() .HasMaxLength(80) - .HasColumnType("character varying(80)"); + .HasColumnType("varchar(80)"); b.Property("NavItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SubNavItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("PermissionId"); @@ -3294,34 +3248,34 @@ namespace ERPCore.Migrations { b.Property("PoLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PoLineId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PoId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("QtyReceived") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("Tax") .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); + .HasColumnType("decimal(9,4)"); b.Property("UnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("PoLineId"); @@ -3337,68 +3291,66 @@ namespace ERPCore.Migrations modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => { b.Property("ConfigId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BatchListsEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("BrandsEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("CustomVariantsEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.Property("CustomWarrantyPeriodsEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.Property("ItemImagesEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.Property("ItemTypesEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SellingPricesEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("SerialNumbersEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("SubcategoriesEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UpdatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WarrantyPeriodsEnabled") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.HasKey("ConfigId"); @@ -3407,7 +3359,7 @@ namespace ERPCore.Migrations b.ToTable("product_config", null, t => { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); + t.HasCheckConstraint("ck_product_config_singleton", "`ConfigId` = 1"); }); }); @@ -3415,57 +3367,55 @@ namespace ERPCore.Migrations { b.Property("RunId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RunId")); b.Property("CancelReasonCodeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("OutputBinId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ReworkCount") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("ScaleFactor") .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); + .HasColumnType("decimal(18,6)"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("TargetQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("TemplateId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("RunId"); @@ -3491,43 +3441,41 @@ namespace ERPCore.Migrations { b.Property("TemplateId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TemplateId")); b.Property("Annotations") - .HasColumnType("jsonb"); + .HasColumnType("longtext"); b.Property("Code") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Description") .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("Name") .IsRequired() .HasMaxLength(150) - .HasColumnType("character varying(150)"); + .HasColumnType("varchar(150)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("TemplateId"); @@ -3545,86 +3493,84 @@ namespace ERPCore.Migrations { b.Property("PurchaseInvoiceId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PurchaseInvoiceId")); b.Property("BalanceAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("GrandTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("PaidAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Draft"); b.Property("Subtotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("VatTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("VendorId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("VendorInvoiceNo") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("VendorSnapshotName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("VendorSnapshotTaxNo") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.HasKey("PurchaseInvoiceId"); @@ -3648,27 +3594,27 @@ namespace ERPCore.Migrations { b.Property("PurchaseInvoiceLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PurchaseInvoiceLineId")); b.Property("GrnId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LineTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Subtotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("VatTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.HasKey("PurchaseInvoiceLineId"); @@ -3684,41 +3630,41 @@ namespace ERPCore.Migrations { b.Property("PurchaseInvoicePaymentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PurchaseInvoicePaymentId")); b.Property("Amount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("BankAccountName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("GlBankAccountId") .HasColumnType("bigint"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Reference") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.HasKey("PurchaseInvoicePaymentId"); @@ -3733,55 +3679,53 @@ namespace ERPCore.Migrations { b.Property("PoId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PoId")); b.Property("ApprovalRequired") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ApprovedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ApproverUserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("RequisitionId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("VendorId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("PoId"); @@ -3807,41 +3751,41 @@ namespace ERPCore.Migrations { b.Property("ReturnId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ReturnId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ReasonCodeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("VendorId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ReturnId"); @@ -3863,22 +3807,22 @@ namespace ERPCore.Migrations { b.Property("ReturnLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ReturnLineId")); b.Property("GrnLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ReturnId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ReturnLineId"); @@ -3895,24 +3839,24 @@ namespace ERPCore.Migrations { b.Property("ReasonCodeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ReasonCodeId")); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Context") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Description") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.HasKey("ReasonCodeId"); @@ -3926,28 +3870,28 @@ namespace ERPCore.Migrations { b.Property("RequisitionId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RequisitionId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("RequestedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("RequisitionId"); @@ -3967,22 +3911,22 @@ namespace ERPCore.Migrations { b.Property("ReqLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ReqLineId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RequiredBy") .HasColumnType("date"); b.Property("RequisitionId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ReqLineId"); @@ -3997,28 +3941,28 @@ namespace ERPCore.Migrations { b.Property("RfqId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RfqId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("RequisitionId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("RfqId"); @@ -4036,19 +3980,19 @@ namespace ERPCore.Migrations { b.Property("RfqLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RfqLineId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RfqId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("RfqLineId"); @@ -4063,47 +4007,45 @@ namespace ERPCore.Migrations { b.Property("RoleId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RoleId")); b.Property("AuthRoleId") - .HasColumnType("uuid") + .HasColumnType("char(36)") .HasColumnName("auth_role_id"); b.Property("Code") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("IsSystemRole") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("RoleId"); @@ -4119,14 +4061,14 @@ namespace ERPCore.Migrations modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => { b.Property("RoleId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PermissionId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Actions") .ValueGeneratedOnAdd() - .HasColumnType("integer") + .HasColumnType("int") .HasDefaultValue(31); b.HasKey("RoleId", "PermissionId"); @@ -4140,18 +4082,18 @@ namespace ERPCore.Migrations { b.Property("RunEdgeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RunEdgeId")); b.Property("ChildRunStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ParentRunStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RunId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("RunEdgeId"); @@ -4169,59 +4111,57 @@ namespace ERPCore.Migrations { b.Property("RunStageId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RunStageId")); b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EstimatedMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("FieldDefs") .IsRequired() - .HasColumnType("jsonb"); + .HasColumnType("longtext"); b.Property("FieldValues") - .HasColumnType("jsonb"); + .HasColumnType("longtext"); b.Property("Name") .IsRequired() .HasMaxLength(150) - .HasColumnType("character varying(150)"); + .HasColumnType("varchar(150)"); b.Property("PosX") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("PosY") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RoleLabel") .HasMaxLength(60) - .HasColumnType("character varying(60)"); + .HasColumnType("varchar(60)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("RunId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("TemplateStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("RunStageId"); @@ -4236,33 +4176,33 @@ namespace ERPCore.Migrations { b.Property("EventId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EventId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EventType") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Note") .HasMaxLength(500) - .HasColumnType("character varying(500)"); + .HasColumnType("varchar(500)"); b.Property("Payload") - .HasColumnType("jsonb"); + .HasColumnType("longtext"); b.Property("RunId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RunStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("UserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("EventId"); @@ -4279,52 +4219,52 @@ namespace ERPCore.Migrations { b.Property("RunInputId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RunInputId")); b.Property("ConsumedQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ConsumedValue") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("DeliveredQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("FromRunOutputId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PlannedQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("QtyUnit") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("ReturnedQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ReturnedValue") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RunStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Source") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("RunInputId"); @@ -4341,42 +4281,42 @@ namespace ERPCore.Migrations { b.Property("RunOutputId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("RunOutputId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Name") .IsRequired() .HasMaxLength(150) - .HasColumnType("character varying(150)"); + .HasColumnType("varchar(150)"); b.Property("PlannedQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ProducedQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RunStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ScrappedQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("TransferredQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("UomId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("RunOutputId"); @@ -4395,49 +4335,47 @@ namespace ERPCore.Migrations { b.Property("SalaryComponentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SalaryComponentId")); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("ComponentType") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("IsTaxable") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("SalaryComponentId"); @@ -4452,50 +4390,48 @@ namespace ERPCore.Migrations modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => { b.Property("ConfigId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("AllowCashCustomer") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.Property("AllowDiscounts") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("AllowFreeItems") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("AllowOverStockSale") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.Property("AllowWarehouseSelection") .ValueGeneratedOnAdd() - .HasColumnType("boolean") + .HasColumnType("tinyint(1)") .HasDefaultValue(true); b.Property("CashCustomerId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DefaultWarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UpdatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ConfigId"); @@ -4515,75 +4451,73 @@ namespace ERPCore.Migrations { b.Property("SalesDayEndId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SalesDayEndId")); b.Property("BalanceTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("BundleCount") .ValueGeneratedOnAdd() - .HasColumnType("integer") + .HasColumnType("int") .HasDefaultValue(0); b.Property("BusinessDate") .HasColumnType("date"); b.Property("CashierUserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ClosedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CostOfGoodsSold") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("DiscountTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("GrandTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("PaidTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SlipCount") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Subtotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("TaxTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.HasKey("SalesDayEndId"); @@ -4602,106 +4536,104 @@ namespace ERPCore.Migrations { b.Property("SalesInvoiceId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SalesInvoiceId")); b.Property("BalanceAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatorUserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CustomerId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CustomerSnapshotName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("CustomerSnapshotTaxNo") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("DiscountTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("GrandTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("InvoiceNo") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("InvoiceType") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("B2C"); b.Property("NetPayable") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("PaidAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RoundOff") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Draft"); b.Property("Subtotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("TaxTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("SalesInvoiceId"); @@ -4727,83 +4659,81 @@ namespace ERPCore.Migrations { b.Property("SalesInvoiceLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SalesInvoiceLineId")); b.Property("BaseCost") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("Description") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("DiscountAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("DiscountMode") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DiscountPct") .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); + .HasColumnType("decimal(9,4)"); b.Property("FreeQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("IsFreeIssue") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LineTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("NetUnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ParentLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PriceSource") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SalesInvoiceId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("TaxAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("TaxPct") .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); + .HasColumnType("decimal(9,4)"); b.Property("UnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("SalesInvoiceLineId"); @@ -4820,41 +4750,41 @@ namespace ERPCore.Migrations { b.Property("SalesInvoicePaymentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SalesInvoicePaymentId")); b.Property("Amount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("BankAccountName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("GlBankAccountId") .HasColumnType("bigint"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Reference") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("SalesInvoiceId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("SalesInvoicePaymentId"); @@ -4869,41 +4799,41 @@ namespace ERPCore.Migrations { b.Property("ReturnId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ReturnId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CustomerId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ReasonCodeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ReturnId"); @@ -4925,22 +4855,22 @@ namespace ERPCore.Migrations { b.Property("ReturnLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ReturnLineId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ReturnId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("ReturnLineId"); @@ -4957,77 +4887,75 @@ namespace ERPCore.Migrations { b.Property("SalesSlipId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SalesSlipId")); b.Property("BalanceAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("CashierUserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CustomerId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CustomerSnapshotName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("DayEndId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DiscountTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("GrandTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("PaidAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("SlipNo") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Draft"); b.Property("Subtotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("TaxTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("SalesSlipId"); @@ -5053,89 +4981,87 @@ namespace ERPCore.Migrations { b.Property("SalesSlipLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SalesSlipLineId")); b.Property("BaseCost") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("BatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Description") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("DiscountAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("DiscountMode") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DiscountPct") .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); + .HasColumnType("decimal(9,4)"); b.Property("FreeQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("IsFreeIssue") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LineTotal") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("NetUnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ParentLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("PriceSource") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SalesSlipId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SerialId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("TaxAmount") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("TaxPct") .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); + .HasColumnType("decimal(9,4)"); b.Property("UnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("SalesSlipLineId"); @@ -5156,26 +5082,26 @@ namespace ERPCore.Migrations { b.Property("SerialId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SerialId")); b.Property("Barcode") .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SerialNo") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("SerialId"); @@ -5192,18 +5118,18 @@ namespace ERPCore.Migrations { b.Property("EdgeId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("EdgeId")); b.Property("ChildStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ParentStageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("TemplateId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("EdgeId"); @@ -5221,32 +5147,32 @@ namespace ERPCore.Migrations { b.Property("InputId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("InputId")); b.Property("FromOutputId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("QtyPerBatch") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("QtyUnit") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Source") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("StageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("InputId"); @@ -5263,27 +5189,27 @@ namespace ERPCore.Migrations { b.Property("OutputId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OutputId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Name") .IsRequired() .HasMaxLength(150) - .HasColumnType("character varying(150)"); + .HasColumnType("varchar(150)"); b.Property("QtyPerBatch") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("StageId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("UomId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("OutputId"); @@ -5300,47 +5226,45 @@ namespace ERPCore.Migrations { b.Property("AdjustmentId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("AdjustmentId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlJournalNo") .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("ReasonCodeId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("AdjustmentId"); @@ -5362,28 +5286,28 @@ namespace ERPCore.Migrations { b.Property("AdjLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("AdjLineId")); b.Property("AdjustmentId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BinId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("QtyDelta") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("SerialId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("AdjLineId"); @@ -5404,42 +5328,40 @@ namespace ERPCore.Migrations { b.Property("CountId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CountId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CountType") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("CountId"); @@ -5461,36 +5383,36 @@ namespace ERPCore.Migrations { b.Property("CountLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CountLineId")); b.Property("BatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BinId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CountId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CountedQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SerialId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SystemQty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("Variance") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.HasKey("CountLineId"); @@ -5511,39 +5433,39 @@ namespace ERPCore.Migrations { b.Property("LayerId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("LayerId")); b.Property("BatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("GrnLineId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("QtyReceived") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("QtyRemaining") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("SerialId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("UnitCost") .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); + .HasColumnType("decimal(18,6)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("LayerId"); @@ -5564,59 +5486,59 @@ namespace ERPCore.Migrations { b.Property("LedgerId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("LedgerId")); b.Property("BatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("BinId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Direction") .IsRequired() .HasMaxLength(5) - .HasColumnType("character varying(5)"); + .HasColumnType("varchar(5)"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("QtyBase") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RunningBalance") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("SerialId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SourceDocId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SourceDocType") .IsRequired() .HasMaxLength(10) - .HasColumnType("character varying(10)"); + .HasColumnType("varchar(10)"); b.Property("UnitCost") .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); + .HasColumnType("decimal(18,6)"); b.Property("UserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Value") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("WarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("LedgerId"); @@ -5643,40 +5565,38 @@ namespace ERPCore.Migrations { b.Property("TransferId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TransferId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DestWarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DocNo") .IsRequired() .HasMaxLength(30) - .HasColumnType("character varying(30)"); + .HasColumnType("varchar(30)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("SrcWarehouseId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.HasKey("TransferId"); @@ -5700,39 +5620,39 @@ namespace ERPCore.Migrations { b.Property("TransferLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TransferLineId")); b.Property("BatchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("DestBinId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Qty") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("QtyReceived") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("SerialId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SrcBinId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("TransferId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("UnitCost") .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); + .HasColumnType("decimal(18,6)"); b.HasKey("TransferLineId"); @@ -5755,36 +5675,34 @@ namespace ERPCore.Migrations { b.Property("SubCategoryId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SubCategoryId")); b.Property("CategoryId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("SubCategoryId"); @@ -5800,39 +5718,39 @@ namespace ERPCore.Migrations { b.Property("SubNavItemId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SubNavItemId")); b.Property("Code") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Href") .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("Icon") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Label") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("NavItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("SortOrder") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.HasKey("SubNavItemId"); @@ -6271,37 +6189,35 @@ namespace ERPCore.Migrations { b.Property("TicketId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TicketId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("CreatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Subject") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("UpdatedBy") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("TicketId"); @@ -6316,26 +6232,26 @@ namespace ERPCore.Migrations { b.Property("MessageId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("MessageId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("IsFromAdmin") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("Message") .IsRequired() .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); + .HasColumnType("varchar(2000)"); b.Property("SenderUserId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("TicketId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("MessageId"); @@ -6348,42 +6264,40 @@ namespace ERPCore.Migrations { b.Property("TaxRateId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TaxRateId")); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.Property("Percentage") .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); + .HasColumnType("decimal(5,2)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("TaxRateId"); @@ -6402,7 +6316,7 @@ namespace ERPCore.Migrations CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), Name = "Standard", Percentage = 15m, - RowVersion = 0u, + RowVersion = 1u, Status = "Active" }, new @@ -6412,7 +6326,7 @@ namespace ERPCore.Migrations CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), Name = "Zero-Rated", Percentage = 0m, - RowVersion = 0u, + RowVersion = 1u, Status = "Active" }, new @@ -6422,7 +6336,7 @@ namespace ERPCore.Migrations CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), Name = "Exempt", Percentage = 0m, - RowVersion = 0u, + RowVersion = 1u, Status = "Active" }); }); @@ -6431,36 +6345,34 @@ namespace ERPCore.Migrations { b.Property("TaxSlabId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TaxSlabId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("LowerBound") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.Property("Rate") .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); + .HasColumnType("decimal(6,4)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("UpperBound") .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); + .HasColumnType("decimal(18,2)"); b.HasKey("TaxSlabId"); @@ -6473,36 +6385,36 @@ namespace ERPCore.Migrations { b.Property("StageId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("StageId")); b.Property("EstimatedMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("FieldDefs") .IsRequired() - .HasColumnType("jsonb"); + .HasColumnType("longtext"); b.Property("Name") .IsRequired() .HasMaxLength(150) - .HasColumnType("character varying(150)"); + .HasColumnType("varchar(150)"); b.Property("PosX") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("PosY") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.Property("RoleLabel") .HasMaxLength(60) - .HasColumnType("character varying(60)"); + .HasColumnType("varchar(60)"); b.Property("TemplateId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("StageId"); @@ -6515,27 +6427,27 @@ namespace ERPCore.Migrations { b.Property("UomId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("UomId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("UomId"); @@ -6551,35 +6463,35 @@ namespace ERPCore.Migrations { b.Property("UserId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("UserId")); b.Property("AuthUserId") - .HasColumnType("uuid") + .HasColumnType("char(36)") .HasColumnName("auth_user_id"); b.Property("DisplayName") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("Email") .HasMaxLength(320) - .HasColumnType("character varying(320)"); + .HasColumnType("varchar(320)"); b.Property("RoleId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("Username") .IsRequired() .HasMaxLength(100) - .HasColumnType("character varying(100)"); + .HasColumnType("varchar(100)"); b.HasKey("UserId"); @@ -6610,56 +6522,54 @@ namespace ERPCore.Migrations { b.Property("VendorId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("VendorId")); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Code") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Currency") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(3) - .HasColumnType("character varying(3)") + .HasColumnType("varchar(3)") .HasDefaultValue("LKR"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("TaxReg") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Terms") .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("VendorId"); @@ -6677,18 +6587,18 @@ namespace ERPCore.Migrations { b.Property("QuotationId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("QuotationId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("RfqId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("VendorId") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("QuotationId"); @@ -6704,22 +6614,22 @@ namespace ERPCore.Migrations { b.Property("QuotationLineId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("QuotationLineId")); b.Property("ItemId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("LeadDays") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("QuotationId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("UnitPrice") .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); + .HasColumnType("decimal(18,4)"); b.HasKey("QuotationLineId"); @@ -6734,28 +6644,28 @@ namespace ERPCore.Migrations { b.Property("WarehouseId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("WarehouseId")); b.Property("Address") - .HasColumnType("text"); + .HasColumnType("longtext"); b.Property("BranchId") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Code") .IsRequired() .HasMaxLength(50) - .HasColumnType("character varying(50)"); + .HasColumnType("varchar(50)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("Phone") - .HasColumnType("text"); + .HasColumnType("longtext"); b.HasKey("WarehouseId"); @@ -6771,25 +6681,25 @@ namespace ERPCore.Migrations { b.Property("WarrantyPeriodId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarrantyPeriodId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("WarrantyPeriodId")); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("Months") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.HasKey("WarrantyPeriodId"); @@ -6808,63 +6718,61 @@ namespace ERPCore.Migrations { b.Property("WorkShiftId") .ValueGeneratedOnAdd() - .HasColumnType("integer"); + .HasColumnType("int"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("WorkShiftId")); b.Property("BreakMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("Code") .IsRequired() .HasMaxLength(20) - .HasColumnType("character varying(20)"); + .HasColumnType("varchar(20)"); b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("EndTime") - .HasColumnType("interval"); + .HasColumnType("time(6)"); b.Property("GraceMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("IsOvernight") - .HasColumnType("boolean"); + .HasColumnType("tinyint(1)"); b.Property("Name") .IsRequired() .HasMaxLength(200) - .HasColumnType("character varying(200)"); + .HasColumnType("varchar(200)"); b.Property("OtMultiplier") .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); + .HasColumnType("decimal(6,2)"); b.Property("RowVersion") .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); + .HasColumnType("int unsigned"); b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); + .HasColumnType("int"); b.Property("StartTime") - .HasColumnType("interval"); + .HasColumnType("time(6)"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(20) - .HasColumnType("character varying(20)") + .HasColumnType("varchar(20)") .HasDefaultValue("Active"); b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + .HasColumnType("datetime(6)"); b.Property("WorkingDaysMask") - .HasColumnType("integer"); + .HasColumnType("int"); b.HasKey("WorkShiftId"); diff --git a/Backend/ERPCore/Program.cs b/Backend/ERPCore/Program.cs index 754f1df..c63ff0d 100644 --- a/Backend/ERPCore/Program.cs +++ b/Backend/ERPCore/Program.cs @@ -17,9 +17,7 @@ using ERPCore.System.Errors; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.OpenApi; -using Npgsql; using Serilog; var builder = WebApplication.CreateBuilder(args); @@ -33,11 +31,17 @@ builder.Host.UseSerilog((ctx, cfg) => cfg builder.Services.AddControllers() .AddJsonOptions(o => o.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter())); -// EF Core + PostgreSQL +// EF Core + MariaDB (Pomelo). The server version is pinned explicitly rather than using +// ServerVersion.AutoDetect: AutoDetect opens a connection, which would make design-time +// commands (`dotnet ef migrations add`) and startup depend on the database being reachable. +// MariaDbServerVersion — not MySqlServerVersion — because the target is MariaDB 10.11, and +// Pomelo changes its SQL translation based on which it is given. +var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") + ?? throw new InvalidOperationException("ConnectionStrings:DefaultConnection is not configured."); + builder.Services.AddDbContext(o => { - o.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection")); - o.ConfigureWarnings(w => w.Ignore(RelationalEventId.PendingModelChangesWarning)); + o.UseMySql(connectionString, new MariaDbServerVersion(new Version(10, 11, 15))); }); // ProblemDetails (RFC 7807) + domain-exception mapping diff --git a/Backend/ERPCore/Services/AdjustmentService.cs b/Backend/ERPCore/Services/AdjustmentService.cs index baee3bc..3c99193 100644 --- a/Backend/ERPCore/Services/AdjustmentService.cs +++ b/Backend/ERPCore/Services/AdjustmentService.cs @@ -106,7 +106,7 @@ public sealed class AdjustmentService : IAdjustmentService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(a => EF.Functions.ILike(a.DocNo, $"%{term}%")); + q = q.Where(a => EF.Functions.Like(a.DocNo, $"%{term}%")); } if (warehouseId is not null) q = q.Where(a => a.WarehouseId == warehouseId); // Warehouses are shared across branches — the adjustment carries its own owning BranchId. diff --git a/Backend/ERPCore/Services/BranchConfigService.cs b/Backend/ERPCore/Services/BranchConfigService.cs index 5fc9194..20d188f 100644 --- a/Backend/ERPCore/Services/BranchConfigService.cs +++ b/Backend/ERPCore/Services/BranchConfigService.cs @@ -18,8 +18,6 @@ namespace ERPCore.Services; ///
public sealed class BranchConfigService : IBranchConfigService { - private const string DefaultBranchCode = "BR-000"; - private const string DefaultBranchName = "Main Branch"; private readonly IRepository _config; private readonly IRepository _branches; @@ -116,10 +114,10 @@ public sealed class BranchConfigService : IBranchConfigService public async Task ResolveDefaultBranchIdAsync(CancellationToken ct = default) { var existingId = await _branches.Query().AsNoTracking() - .Where(b => b.Code == DefaultBranchCode).Select(b => b.BranchId).FirstOrDefaultAsync(ct); + .Where(b => b.Code == Branch.DefaultCode).Select(b => b.BranchId).FirstOrDefaultAsync(ct); if (existingId != 0) return existingId; - var branch = new Branch { Code = DefaultBranchCode, Name = DefaultBranchName, Status = EntityStatus.Active, CreatedAt = DateTime.UtcNow }; + var branch = new Branch { Code = Branch.DefaultCode, Name = Branch.DefaultName, Status = EntityStatus.Active, CreatedAt = DateTime.UtcNow }; await _branches.AddAsync(branch, ct); await _uow.SaveChangesAsync(ct); return branch.BranchId; diff --git a/Backend/ERPCore/Services/BrandService.cs b/Backend/ERPCore/Services/BrandService.cs index dce5fd3..b736e48 100644 --- a/Backend/ERPCore/Services/BrandService.cs +++ b/Backend/ERPCore/Services/BrandService.cs @@ -32,7 +32,7 @@ public sealed class BrandService : IBrandService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(b => EF.Functions.ILike(b.Name, $"%{term}%")); + q = q.Where(b => EF.Functions.Like(b.Name, $"%{term}%")); } if (status is not null) q = q.Where(b => b.Status == status); diff --git a/Backend/ERPCore/Services/BundleSaleService.cs b/Backend/ERPCore/Services/BundleSaleService.cs index 2cdf7eb..9be21f1 100644 --- a/Backend/ERPCore/Services/BundleSaleService.cs +++ b/Backend/ERPCore/Services/BundleSaleService.cs @@ -62,7 +62,7 @@ public sealed class BundleSaleService : IBundleSaleService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(x => EF.Functions.ILike(x.TemplateCode, $"%{term}%") || EF.Functions.ILike(x.TemplateName, $"%{term}%") || EF.Functions.ILike(x.Description ?? "", $"%{term}%")); + q = q.Where(x => EF.Functions.Like(x.TemplateCode, $"%{term}%") || EF.Functions.Like(x.TemplateName, $"%{term}%") || EF.Functions.Like(x.Description ?? "", $"%{term}%")); } var total = await q.CountAsync(ct); var rows = await q.OrderByDescending(x => x.BundleSaleTemplateId).Skip(query.Skip).Take(query.PageSize).ToListAsync(ct); @@ -130,7 +130,7 @@ public sealed class BundleSaleService : IBundleSaleService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(x => EF.Functions.ILike(x.BundleNo, $"%{term}%") || EF.Functions.ILike(x.BundleName, $"%{term}%") || EF.Functions.ILike(x.BundleCode, $"%{term}%")); + q = q.Where(x => EF.Functions.Like(x.BundleNo, $"%{term}%") || EF.Functions.Like(x.BundleName, $"%{term}%") || EF.Functions.Like(x.BundleCode, $"%{term}%")); } if (status is not null) q = q.Where(x => x.Status == status); if (customerId is not null) q = q.Where(x => x.CustomerId == customerId); @@ -181,7 +181,6 @@ public sealed class BundleSaleService : IBundleSaleService Recalculate(bundle, request.BundlePrice); bundle.BundleCode = $"{bundle.BundleNo}-B"; await _bundles.AddAsync(bundle, ct); - bundle.ConcurrencyStamp = 1; await _uow.SaveChangesAsync(ct); return Map(bundle); } @@ -206,7 +205,6 @@ public sealed class BundleSaleService : IBundleSaleService foreach (var line in await BuildLinesAsync(template, request.WarehouseId, request.Lines, ct)) bundle.Lines.Add(line); Recalculate(bundle, request.BundlePrice); bundle.UpdatedAt = DateTime.UtcNow; - bundle.ConcurrencyStamp++; await _uow.SaveChangesAsync(ct); return Map(bundle); } @@ -227,7 +225,6 @@ public sealed class BundleSaleService : IBundleSaleService throw new ConflictException($"Bundle sale {bundleSaleId} is {bundle.Status} and cannot be cancelled."); bundle.Status = BundleSaleStatus.Cancelled; bundle.UpdatedAt = DateTime.UtcNow; - bundle.ConcurrencyStamp++; await _uow.SaveChangesAsync(ct); return Map(bundle); } diff --git a/Backend/ERPCore/Services/CategoryService.cs b/Backend/ERPCore/Services/CategoryService.cs index a84e40a..0026a28 100644 --- a/Backend/ERPCore/Services/CategoryService.cs +++ b/Backend/ERPCore/Services/CategoryService.cs @@ -41,7 +41,7 @@ public sealed class CategoryService : ICategoryService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(c => EF.Functions.ILike(c.Name, $"%{term}%")); + q = q.Where(c => EF.Functions.Like(c.Name, $"%{term}%")); } if (status is not null) q = q.Where(c => c.Status == status); @@ -123,7 +123,7 @@ public sealed class CategoryService : ICategoryService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(s => EF.Functions.ILike(s.Name, $"%{term}%")); + q = q.Where(s => EF.Functions.Like(s.Name, $"%{term}%")); } if (status is not null) q = q.Where(s => s.Status == status); diff --git a/Backend/ERPCore/Services/CountService.cs b/Backend/ERPCore/Services/CountService.cs index a3d662c..19ab126 100644 --- a/Backend/ERPCore/Services/CountService.cs +++ b/Backend/ERPCore/Services/CountService.cs @@ -113,7 +113,7 @@ public sealed class CountService : ICountService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(c => EF.Functions.ILike(c.DocNo, $"%{term}%")); + q = q.Where(c => EF.Functions.Like(c.DocNo, $"%{term}%")); } if (status is not null) q = q.Where(c => c.Status == status); if (warehouseId is not null) q = q.Where(c => c.WarehouseId == warehouseId); diff --git a/Backend/ERPCore/Services/CustomerService.cs b/Backend/ERPCore/Services/CustomerService.cs index a67c204..fc7b112 100644 --- a/Backend/ERPCore/Services/CustomerService.cs +++ b/Backend/ERPCore/Services/CustomerService.cs @@ -54,9 +54,9 @@ public sealed class CustomerService : ICustomerService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(c => EF.Functions.ILike(c.Name, $"%{term}%") - || EF.Functions.ILike(c.CustomerCode, $"%{term}%") - || (c.DisplayName != null && EF.Functions.ILike(c.DisplayName, $"%{term}%"))); + q = q.Where(c => EF.Functions.Like(c.Name, $"%{term}%") + || EF.Functions.Like(c.CustomerCode, $"%{term}%") + || (c.DisplayName != null && EF.Functions.Like(c.DisplayName, $"%{term}%"))); } if (status is not null) q = q.Where(c => c.Status == status); if (customerType is not null) q = q.Where(c => c.CustomerType == customerType); @@ -172,7 +172,15 @@ public sealed class CustomerService : ICustomerService customer.BranchId = await _branchConfig.ResolveBranchIdAsync(request.BranchId, ct); customer.UpdatedAt = DateTime.UtcNow; - await _uow.SaveChangesAsync(ct); + try + { + await _uow.SaveChangesAsync(ct); + } + catch (DbUpdateConcurrencyException) + { + throw new DomainException(ErrorCodes.ConcurrencyConflict, "The customer was modified by another request.", 412); + } + return new ETagged(Map(customer), customer.RowVersion); } diff --git a/Backend/ERPCore/Services/GlobalSearchService.cs b/Backend/ERPCore/Services/GlobalSearchService.cs index 40ba042..5b2bddf 100644 --- a/Backend/ERPCore/Services/GlobalSearchService.cs +++ b/Backend/ERPCore/Services/GlobalSearchService.cs @@ -40,28 +40,28 @@ public sealed class GlobalSearchService : IGlobalSearchService // Sequential, not parallel: these share one scoped DbContext, which EF Core // does not allow concurrent operations against. var items = await _items.Query().AsNoTracking() - .Where(i => EF.Functions.ILike(i.Sku, pattern) || EF.Functions.ILike(i.Name, pattern)) + .Where(i => EF.Functions.Like(i.Sku, pattern) || EF.Functions.Like(i.Name, pattern)) .OrderBy(i => i.Name) .Take(takePerType) .Select(i => new GlobalSearchResultDto(GlobalSearchResultType.Item, i.ItemId, i.Sku, i.Name, i.Sku)) .ToListAsync(ct); var pos = await _purchaseOrders.Query().AsNoTracking() - .Where(p => EF.Functions.ILike(p.DocNo, pattern)) + .Where(p => EF.Functions.Like(p.DocNo, pattern)) .OrderByDescending(p => p.PoId) .Take(takePerType) .Select(p => new GlobalSearchResultDto(GlobalSearchResultType.PurchaseOrder, p.PoId, p.DocNo, p.DocNo, p.Status.ToString())) .ToListAsync(ct); var invoices = await _salesSlips.Query().AsNoTracking() - .Where(s => EF.Functions.ILike(s.SlipNo, pattern) || EF.Functions.ILike(s.CustomerSnapshotName, pattern)) + .Where(s => EF.Functions.Like(s.SlipNo, pattern) || EF.Functions.Like(s.CustomerSnapshotName, pattern)) .OrderByDescending(s => s.SalesSlipId) .Take(takePerType) .Select(s => new GlobalSearchResultDto(GlobalSearchResultType.Invoice, s.SalesSlipId, s.SlipNo, s.SlipNo, s.CustomerSnapshotName)) .ToListAsync(ct); var employees = await _employees.Query().AsNoTracking() - .Where(e => EF.Functions.ILike(e.FullName, pattern) || EF.Functions.ILike(e.EmployeeCode, pattern)) + .Where(e => EF.Functions.Like(e.FullName, pattern) || EF.Functions.Like(e.EmployeeCode, pattern)) .OrderBy(e => e.FullName) .Take(takePerType) .Select(e => new GlobalSearchResultDto(GlobalSearchResultType.Employee, e.EmployeeId, e.EmployeeCode, e.FullName, e.EmployeeCode)) diff --git a/Backend/ERPCore/Services/GrnService.cs b/Backend/ERPCore/Services/GrnService.cs index ddb309c..1fcf1dd 100644 --- a/Backend/ERPCore/Services/GrnService.cs +++ b/Backend/ERPCore/Services/GrnService.cs @@ -88,7 +88,7 @@ public sealed class GrnService : IGrnService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(g => EF.Functions.ILike(g.DocNo, $"%{term}%")); + q = q.Where(g => EF.Functions.Like(g.DocNo, $"%{term}%")); } if (status is not null) q = q.Where(g => g.Status == status); if (poId is not null) q = q.Where(g => g.PoId == poId); diff --git a/Backend/ERPCore/Services/Hrm/BranchService.cs b/Backend/ERPCore/Services/Hrm/BranchService.cs index 09adc66..9c7cfc8 100644 --- a/Backend/ERPCore/Services/Hrm/BranchService.cs +++ b/Backend/ERPCore/Services/Hrm/BranchService.cs @@ -29,7 +29,7 @@ public sealed class BranchService : IBranchService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(b => EF.Functions.ILike(b.Name, $"%{term}%") || EF.Functions.ILike(b.Code, $"%{term}%")); + q = q.Where(b => EF.Functions.Like(b.Name, $"%{term}%") || EF.Functions.Like(b.Code, $"%{term}%")); } if (status is not null) q = q.Where(b => b.Status == status); diff --git a/Backend/ERPCore/Services/Hrm/DepartmentService.cs b/Backend/ERPCore/Services/Hrm/DepartmentService.cs index d99f867..f0fae07 100644 --- a/Backend/ERPCore/Services/Hrm/DepartmentService.cs +++ b/Backend/ERPCore/Services/Hrm/DepartmentService.cs @@ -34,7 +34,7 @@ public sealed class DepartmentService : IDepartmentService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(d => EF.Functions.ILike(d.Name, $"%{term}%") || EF.Functions.ILike(d.Code, $"%{term}%")); + q = q.Where(d => EF.Functions.Like(d.Name, $"%{term}%") || EF.Functions.Like(d.Code, $"%{term}%")); } if (status is not null) q = q.Where(d => d.Status == status); diff --git a/Backend/ERPCore/Services/Hrm/DesignationService.cs b/Backend/ERPCore/Services/Hrm/DesignationService.cs index 424b561..5531699 100644 --- a/Backend/ERPCore/Services/Hrm/DesignationService.cs +++ b/Backend/ERPCore/Services/Hrm/DesignationService.cs @@ -29,7 +29,7 @@ public sealed class DesignationService : IDesignationService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(d => EF.Functions.ILike(d.Name, $"%{term}%") || EF.Functions.ILike(d.Code, $"%{term}%")); + q = q.Where(d => EF.Functions.Like(d.Name, $"%{term}%") || EF.Functions.Like(d.Code, $"%{term}%")); } if (status is not null) q = q.Where(d => d.Status == status); diff --git a/Backend/ERPCore/Services/Hrm/EmployeeService.cs b/Backend/ERPCore/Services/Hrm/EmployeeService.cs index 124c4b7..2bbebe1 100644 --- a/Backend/ERPCore/Services/Hrm/EmployeeService.cs +++ b/Backend/ERPCore/Services/Hrm/EmployeeService.cs @@ -70,7 +70,7 @@ public sealed class EmployeeService : IEmployeeService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(e => EF.Functions.ILike(e.FullName, $"%{term}%") || EF.Functions.ILike(e.EmployeeCode, $"%{term}%")); + q = q.Where(e => EF.Functions.Like(e.FullName, $"%{term}%") || EF.Functions.Like(e.EmployeeCode, $"%{term}%")); } if (status is not null) q = q.Where(e => e.Status == status); if (departmentId is not null) q = q.Where(e => e.DepartmentId == departmentId); diff --git a/Backend/ERPCore/Services/Hrm/EmployeeUserLinkService.cs b/Backend/ERPCore/Services/Hrm/EmployeeUserLinkService.cs index 4cf3cb9..a8c5312 100644 --- a/Backend/ERPCore/Services/Hrm/EmployeeUserLinkService.cs +++ b/Backend/ERPCore/Services/Hrm/EmployeeUserLinkService.cs @@ -34,7 +34,7 @@ public sealed class EmployeeUserLinkService : IEmployeeUserLinkService { var term = email.Trim(); var employee = await _employees.Query().AsNoTracking() - .Where(e => e.UserId == null && e.Email != null && EF.Functions.ILike(e.Email, term)) + .Where(e => e.UserId == null && e.Email != null && e.Email == term) .Select(e => new EmployeeMatchDto(e.EmployeeId, e.EmployeeCode, e.FullName, e.Email!)) .FirstOrDefaultAsync(ct); return employee; @@ -46,7 +46,7 @@ public sealed class EmployeeUserLinkService : IEmployeeUserLinkService var linkedUserIds = _employees.Query().Where(e => e.UserId != null).Select(e => e.UserId!.Value); var user = await _users.Query().AsNoTracking() - .Where(u => u.Email != null && EF.Functions.ILike(u.Email, term) && !linkedUserIds.Contains(u.UserId)) + .Where(u => u.Email != null && u.Email == term && !linkedUserIds.Contains(u.UserId)) .Select(u => new UserMatchDto(u.UserId, u.Username, u.DisplayName, u.Email!)) .FirstOrDefaultAsync(ct); return user; diff --git a/Backend/ERPCore/Services/Hrm/EmploymentTypeService.cs b/Backend/ERPCore/Services/Hrm/EmploymentTypeService.cs index d2ab520..f7fa656 100644 --- a/Backend/ERPCore/Services/Hrm/EmploymentTypeService.cs +++ b/Backend/ERPCore/Services/Hrm/EmploymentTypeService.cs @@ -29,7 +29,7 @@ public sealed class EmploymentTypeService : IEmploymentTypeService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(e => EF.Functions.ILike(e.Name, $"%{term}%") || EF.Functions.ILike(e.Code, $"%{term}%")); + q = q.Where(e => EF.Functions.Like(e.Name, $"%{term}%") || EF.Functions.Like(e.Code, $"%{term}%")); } if (status is not null) q = q.Where(e => e.Status == status); diff --git a/Backend/ERPCore/Services/Hrm/HrDocumentTypeService.cs b/Backend/ERPCore/Services/Hrm/HrDocumentTypeService.cs index f5f7570..7f3286f 100644 --- a/Backend/ERPCore/Services/Hrm/HrDocumentTypeService.cs +++ b/Backend/ERPCore/Services/Hrm/HrDocumentTypeService.cs @@ -29,7 +29,7 @@ public sealed class HrDocumentTypeService : IHrDocumentTypeService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(t => EF.Functions.ILike(t.Name, $"%{term}%") || EF.Functions.ILike(t.Code, $"%{term}%")); + q = q.Where(t => EF.Functions.Like(t.Name, $"%{term}%") || EF.Functions.Like(t.Code, $"%{term}%")); } if (status is not null) q = q.Where(t => t.Status == status); diff --git a/Backend/ERPCore/Services/Hrm/LeaveRequestService.cs b/Backend/ERPCore/Services/Hrm/LeaveRequestService.cs index d0819ce..e803b8d 100644 --- a/Backend/ERPCore/Services/Hrm/LeaveRequestService.cs +++ b/Backend/ERPCore/Services/Hrm/LeaveRequestService.cs @@ -46,7 +46,7 @@ public sealed class LeaveRequestService : ILeaveRequestService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(r => EF.Functions.ILike(r.DocNo, $"%{term}%") || EF.Functions.ILike(r.Employee!.FullName, $"%{term}%")); + q = q.Where(r => EF.Functions.Like(r.DocNo, $"%{term}%") || EF.Functions.Like(r.Employee!.FullName, $"%{term}%")); } var total = await q.CountAsync(ct); diff --git a/Backend/ERPCore/Services/Hrm/LeaveTypeService.cs b/Backend/ERPCore/Services/Hrm/LeaveTypeService.cs index 9cda259..fd59a46 100644 --- a/Backend/ERPCore/Services/Hrm/LeaveTypeService.cs +++ b/Backend/ERPCore/Services/Hrm/LeaveTypeService.cs @@ -29,7 +29,7 @@ public sealed class LeaveTypeService : ILeaveTypeService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(t => EF.Functions.ILike(t.Name, $"%{term}%") || EF.Functions.ILike(t.Code, $"%{term}%")); + q = q.Where(t => EF.Functions.Like(t.Name, $"%{term}%") || EF.Functions.Like(t.Code, $"%{term}%")); } if (status is not null) q = q.Where(t => t.Status == status); diff --git a/Backend/ERPCore/Services/Hrm/SalaryComponentService.cs b/Backend/ERPCore/Services/Hrm/SalaryComponentService.cs index 9e7af81..33ad5d5 100644 --- a/Backend/ERPCore/Services/Hrm/SalaryComponentService.cs +++ b/Backend/ERPCore/Services/Hrm/SalaryComponentService.cs @@ -29,7 +29,7 @@ public sealed class SalaryComponentService : ISalaryComponentService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(c => EF.Functions.ILike(c.Name, $"%{term}%") || EF.Functions.ILike(c.Code, $"%{term}%")); + q = q.Where(c => EF.Functions.Like(c.Name, $"%{term}%") || EF.Functions.Like(c.Code, $"%{term}%")); } if (status is not null) q = q.Where(c => c.Status == status); diff --git a/Backend/ERPCore/Services/Hrm/WorkShiftService.cs b/Backend/ERPCore/Services/Hrm/WorkShiftService.cs index eabb31c..e995501 100644 --- a/Backend/ERPCore/Services/Hrm/WorkShiftService.cs +++ b/Backend/ERPCore/Services/Hrm/WorkShiftService.cs @@ -32,7 +32,7 @@ public sealed class WorkShiftService : IWorkShiftService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(w => EF.Functions.ILike(w.Name, $"%{term}%") || EF.Functions.ILike(w.Code, $"%{term}%")); + q = q.Where(w => EF.Functions.Like(w.Name, $"%{term}%") || EF.Functions.Like(w.Code, $"%{term}%")); } if (status is not null) q = q.Where(w => w.Status == status); diff --git a/Backend/ERPCore/Services/ItemService.cs b/Backend/ERPCore/Services/ItemService.cs index 0f73350..a6d13b4 100644 --- a/Backend/ERPCore/Services/ItemService.cs +++ b/Backend/ERPCore/Services/ItemService.cs @@ -88,7 +88,7 @@ public sealed class ItemService : IItemService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(i => EF.Functions.ILike(i.Sku, $"%{term}%") || EF.Functions.ILike(i.Name, $"%{term}%")); + q = q.Where(i => EF.Functions.Like(i.Sku, $"%{term}%") || EF.Functions.Like(i.Name, $"%{term}%")); } if (status is not null) q = q.Where(i => i.Status == status); if (categoryId is not null) q = q.Where(i => i.CategoryId == categoryId); @@ -122,7 +122,7 @@ public sealed class ItemService : IItemService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(i => EF.Functions.ILike(i.Sku, $"%{term}%") || EF.Functions.ILike(i.Name, $"%{term}%")); + q = q.Where(i => EF.Functions.Like(i.Sku, $"%{term}%") || EF.Functions.Like(i.Name, $"%{term}%")); } if (status is not null) q = q.Where(i => i.Status == status); if (categoryId is not null) q = q.Where(i => i.CategoryId == categoryId); diff --git a/Backend/ERPCore/Services/ItemTypeService.cs b/Backend/ERPCore/Services/ItemTypeService.cs index 015c662..3672423 100644 --- a/Backend/ERPCore/Services/ItemTypeService.cs +++ b/Backend/ERPCore/Services/ItemTypeService.cs @@ -34,7 +34,7 @@ public sealed class ItemTypeService : IItemTypeService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(t => EF.Functions.ILike(t.Name, $"%{term}%")); + q = q.Where(t => EF.Functions.Like(t.Name, $"%{term}%")); } if (status is not null) q = q.Where(t => t.Status == status); diff --git a/Backend/ERPCore/Services/NumberSequenceService.cs b/Backend/ERPCore/Services/NumberSequenceService.cs index 56fdeca..055abd4 100644 --- a/Backend/ERPCore/Services/NumberSequenceService.cs +++ b/Backend/ERPCore/Services/NumberSequenceService.cs @@ -9,16 +9,30 @@ using Microsoft.EntityFrameworkCore.Storage; namespace ERPCore.Services; /// -/// Atomic document-number issuer. Uses a single INSERT … ON CONFLICT … DO UPDATE -/// … RETURNING so concurrent issues for the same (docType, branchId, year) cannot get -/// the same number (the row is locked for the duration of the upsert). Runs as a direct -/// ADO.NET command enlisted in the DbContext's current transaction so it commits or -/// rolls back with the document (FR-X-03). EF's SqlQuery is avoided here -/// because it wraps the statement in a subquery, which PostgreSQL disallows for a -/// data-modifying statement. Numbering is per-branch (docs/BRANCH_ISOLATION_PLAN.md §5): -/// the sequence key is (doc_type, branch_id, year) and the format includes the branch code, -/// e.g. PO-BR-001-2026-00042. +/// Atomic document-number issuer. Uses a single INSERT … ON DUPLICATE KEY UPDATE … +/// RETURNING so concurrent issues for the same (docType, branchId, year) cannot get +/// the same number (the upsert holds an exclusive lock on the row until commit). Runs as a +/// direct ADO.NET command enlisted in the DbContext's current transaction so it commits or +/// rolls back with the document (FR-X-03). EF's SqlQuery is avoided here because it +/// wraps the statement in a subquery, which is not valid for a data-modifying statement. +/// Numbering is per-branch (docs/BRANCH_ISOLATION_PLAN.md §5): the sequence key is +/// (doc_type, branch_id, year) and the format includes the branch code, e.g. +/// PO-BR-001-2026-00042. /// +/// +/// MariaDB 10.5+ supports RETURNING on an upsert, so this stays a single atomic +/// statement exactly as the PostgreSQL version was — which is what keeps the callers that +/// run outside a UoW transaction safe. Do NOT "optimise" this into the one-statement +/// LAST_INSERT_ID() trick: this table has an AUTO_INCREMENT surrogate key, so on the +/// insert branch the engine's own auto-increment value clobbers the explicit one and the +/// first document of a (docType, branch, year) would be numbered with the sequence table's +/// PK. Splitting it into INSERT-then-SELECT is also wrong here, because the non-transacted +/// callers would then race. Side note: the surrogate AUTO_INCREMENT burns a value on the +/// duplicate path, so sequence_id has gaps — harmless, do not "fix" it. +/// ON DUPLICATE KEY UPDATE fires on any unique-key collision; today the only unique +/// keys are the never-supplied PK and IX(doc_type, branch_id, year), so it is unambiguous. +/// Adding another unique index to this table would silently change which row gets updated. +/// public sealed class NumberSequenceService : INumberSequenceService { private readonly ErpDbContext _db; @@ -53,11 +67,10 @@ public sealed class NumberSequenceService : INumberSequenceService await using var cmd = conn.CreateCommand(); cmd.Transaction = _db.Database.CurrentTransaction?.GetDbTransaction(); cmd.CommandText = """ - INSERT INTO number_sequences (doc_type, branch_id, year, last_number) + INSERT INTO `number_sequences` (`doc_type`, `branch_id`, `year`, `last_number`) VALUES (@docType, @branchId, @year, 1) - ON CONFLICT (doc_type, branch_id, year) - DO UPDATE SET last_number = number_sequences.last_number + 1 - RETURNING last_number; + ON DUPLICATE KEY UPDATE `last_number` = `last_number` + 1 + RETURNING `last_number`; """; AddParam(cmd, "docType", docType); AddParam(cmd, "branchId", branchId); diff --git a/Backend/ERPCore/Services/Production/ProductionRunService.cs b/Backend/ERPCore/Services/Production/ProductionRunService.cs index 18b4bfb..2b5b626 100644 --- a/Backend/ERPCore/Services/Production/ProductionRunService.cs +++ b/Backend/ERPCore/Services/Production/ProductionRunService.cs @@ -73,7 +73,7 @@ public sealed class ProductionRunService : IProductionRunService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(r => EF.Functions.ILike(r.DocNo, $"%{term}%")); + q = q.Where(r => EF.Functions.Like(r.DocNo, $"%{term}%")); } if (status is not null) q = q.Where(r => r.Status == status); @@ -342,7 +342,7 @@ public sealed class ProductionRunService : IProductionRunService }); } - await _uow.ExecuteInTransactionAsync(async token => + await SaveGuardingConcurrencyAsync(async token => { // Must be inside the transaction — NumberSequenceService enlists in it. run.DocNo = await _numbers.NextAsync(DocumentTypes.Production, token); @@ -363,7 +363,7 @@ public sealed class ProductionRunService : IProductionRunService { RunStage? stage = null; - await _uow.ExecuteInTransactionAsync(async token => + await SaveGuardingConcurrencyAsync(async token => { var run = await LoadGraphQuery().FirstOrDefaultAsync(r => r.RunId == runId, token) ?? throw new NotFoundException($"Production run {runId} was not found."); @@ -546,7 +546,7 @@ public sealed class ProductionRunService : IProductionRunService var consumed = new List(); var ledgerRefs = new List(); - await _uow.ExecuteInTransactionAsync(async token => + await SaveGuardingConcurrencyAsync(async token => { var (run, stage) = await LoadForActionAsync(runId, runStageId, token); @@ -607,7 +607,7 @@ public sealed class ProductionRunService : IProductionRunService public async Task CompleteStageAsync( int runId, int runStageId, CompleteStageRequest request, CancellationToken ct = default) { - await _uow.ExecuteInTransactionAsync(async token => + await SaveGuardingConcurrencyAsync(async token => { var (run, stage) = await LoadForActionAsync(runId, runStageId, token); @@ -677,7 +677,7 @@ public sealed class ProductionRunService : IProductionRunService CostPoolDto? costPool = null; var runStatus = ProductionRunStatus.InProgress; - await _uow.ExecuteInTransactionAsync(async token => + await SaveGuardingConcurrencyAsync(async token => { var (run, stage) = await LoadForActionAsync(runId, runStageId, token); @@ -756,7 +756,7 @@ public sealed class ProductionRunService : IProductionRunService { var transfers = new List(); - await _uow.ExecuteInTransactionAsync(async token => + await SaveGuardingConcurrencyAsync(async token => { var (run, stage) = await LoadForActionAsync(runId, runStageId, token); @@ -785,7 +785,7 @@ public sealed class ProductionRunService : IProductionRunService decimal unitCost = 0, returnValue = 0, returnedQty = 0; CostPoolDto pool = new(0, 0, 0); - await _uow.ExecuteInTransactionAsync(async token => + await SaveGuardingConcurrencyAsync(async token => { var run = await LoadGraphQuery().FirstOrDefaultAsync(r => r.RunId == runId, token) ?? throw new NotFoundException($"Production run {runId} was not found."); @@ -856,7 +856,7 @@ public sealed class ProductionRunService : IProductionRunService { var pulled = new List(); - await _uow.ExecuteInTransactionAsync(async token => + await SaveGuardingConcurrencyAsync(async token => { var (run, stage) = await LoadForActionAsync(runId, runStageId, token); @@ -930,7 +930,7 @@ public sealed class ProductionRunService : IProductionRunService { var reworkNumber = 0; - await _uow.ExecuteInTransactionAsync(async token => + await SaveGuardingConcurrencyAsync(async token => { var (run, stage) = await LoadForActionAsync(runId, runStageId, token); @@ -1026,7 +1026,7 @@ public sealed class ProductionRunService : IProductionRunService var writeOffs = new List(); var ledgerRefs = new List(); - await _uow.ExecuteInTransactionAsync(async token => + await SaveGuardingConcurrencyAsync(async token => { var run = await LoadGraphQuery().FirstOrDefaultAsync(r => r.RunId == runId, token) ?? throw new NotFoundException($"Production run {runId} was not found."); @@ -1297,6 +1297,26 @@ public sealed class ProductionRunService : IProductionRunService $"Required field(s) not provided for stage '{stage.Name}': {string.Join(", ", missing)}.", 400); } + /// + /// Runs in a transaction, translating a lost optimistic-concurrency + /// race (two users acting on the same run or stage) into a 412 rather than a bare 500. + /// The catch has to sit outside the lambda: + /// issues its own SaveChangesAsync after the lambda returns, so a try inside it would + /// miss the save that actually writes the RowVersion check. + /// + private async Task SaveGuardingConcurrencyAsync(Func work, CancellationToken ct) + { + try + { + await _uow.ExecuteInTransactionAsync(work, ct); + } + catch (DbUpdateConcurrencyException) + { + throw new DomainException(ErrorCodes.ConcurrencyConflict, + "The production run or the stock it uses was modified by another request.", 412); + } + } + private async Task EnsureProductionReasonAsync(int reasonCodeId, CancellationToken ct) { var reason = await _reasonCodes.Query().AsNoTracking() diff --git a/Backend/ERPCore/Services/Production/ProductionTemplateService.cs b/Backend/ERPCore/Services/Production/ProductionTemplateService.cs index 3e304c2..59279f4 100644 --- a/Backend/ERPCore/Services/Production/ProductionTemplateService.cs +++ b/Backend/ERPCore/Services/Production/ProductionTemplateService.cs @@ -56,7 +56,7 @@ public sealed class ProductionTemplateService : IProductionTemplateService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(t => EF.Functions.ILike(t.Code, $"%{term}%") || EF.Functions.ILike(t.Name, $"%{term}%")); + q = q.Where(t => EF.Functions.Like(t.Code, $"%{term}%") || EF.Functions.Like(t.Name, $"%{term}%")); } if (status is not null) q = q.Where(t => t.Status == status); @@ -192,7 +192,7 @@ public sealed class ProductionTemplateService : IProductionTemplateService if (await _templates.Query().AnyAsync(t => t.Code == code && t.TemplateId != templateId, ct)) throw new ConflictException($"A production template with code '{code}' already exists."); - await _uow.ExecuteInTransactionAsync(async token => + await SaveGuardingConcurrencyAsync(async token => { var template = await LoadGraphQuery().FirstOrDefaultAsync(t => t.TemplateId == templateId, token) ?? throw new NotFoundException($"Production template {templateId} was not found."); @@ -478,6 +478,26 @@ public sealed class ProductionTemplateService : IProductionTemplateService } } + /// + /// Runs in a transaction, translating a lost optimistic-concurrency + /// race into the same 412 the RowVersion pre-check returns. The catch has to sit + /// outside the lambda: issues its own + /// SaveChangesAsync after the lambda returns, so a try inside it would miss the save + /// that actually writes the token check. + /// + private async Task SaveGuardingConcurrencyAsync(Func work, CancellationToken ct) + { + try + { + await _uow.ExecuteInTransactionAsync(work, ct); + } + catch (DbUpdateConcurrencyException) + { + throw new DomainException(ErrorCodes.ConcurrencyConflict, + "The template was modified by another request.", 412); + } + } + // --- mapping ------------------------------------------------------------- private async Task> RequireGraphAsync(int templateId, CancellationToken ct) diff --git a/Backend/ERPCore/Services/PurchaseInvoiceService.cs b/Backend/ERPCore/Services/PurchaseInvoiceService.cs index 4d2b6c7..ccb54ef 100644 --- a/Backend/ERPCore/Services/PurchaseInvoiceService.cs +++ b/Backend/ERPCore/Services/PurchaseInvoiceService.cs @@ -59,9 +59,9 @@ public sealed class PurchaseInvoiceService : IPurchaseInvoiceService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(x => EF.Functions.ILike(x.DocNo, $"%{term}%") - || EF.Functions.ILike(x.VendorInvoiceNo, $"%{term}%") - || EF.Functions.ILike(x.VendorSnapshotName, $"%{term}%")); + q = q.Where(x => EF.Functions.Like(x.DocNo, $"%{term}%") + || EF.Functions.Like(x.VendorInvoiceNo, $"%{term}%") + || EF.Functions.Like(x.VendorSnapshotName, $"%{term}%")); } if (status is not null) q = q.Where(x => x.Status == status); if (vendorId is not null) q = q.Where(x => x.VendorId == vendorId); @@ -156,7 +156,15 @@ public sealed class PurchaseInvoiceService : IPurchaseInvoiceService Recalculate(invoice); invoice.UpdatedAt = DateTime.UtcNow; - await _uow.SaveChangesAsync(ct); + try + { + await _uow.SaveChangesAsync(ct); + } + catch (DbUpdateConcurrencyException) + { + throw new DomainException(ErrorCodes.ConcurrencyConflict, "The purchase invoice was modified by another request.", 412); + } + return new ETagged(MapInvoice(invoice), invoice.RowVersion); } diff --git a/Backend/ERPCore/Services/PurchaseOrderService.cs b/Backend/ERPCore/Services/PurchaseOrderService.cs index a83e845..ca0f881 100644 --- a/Backend/ERPCore/Services/PurchaseOrderService.cs +++ b/Backend/ERPCore/Services/PurchaseOrderService.cs @@ -61,7 +61,7 @@ public sealed class PurchaseOrderService : IPurchaseOrderService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(p => EF.Functions.ILike(p.DocNo, $"%{term}%")); + q = q.Where(p => EF.Functions.Like(p.DocNo, $"%{term}%")); } if (status is not null) q = q.Where(p => p.Status == status); if (vendorId is not null) q = q.Where(p => p.VendorId == vendorId); diff --git a/Backend/ERPCore/Services/PurchaseReturnService.cs b/Backend/ERPCore/Services/PurchaseReturnService.cs index d2d2ca7..03c834a 100644 --- a/Backend/ERPCore/Services/PurchaseReturnService.cs +++ b/Backend/ERPCore/Services/PurchaseReturnService.cs @@ -79,7 +79,7 @@ public sealed class PurchaseReturnService : IPurchaseReturnService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(r => EF.Functions.ILike(r.DocNo, $"%{term}%")); + q = q.Where(r => EF.Functions.Like(r.DocNo, $"%{term}%")); } if (vendorId is not null) q = q.Where(r => r.VendorId == vendorId); if (warehouseId is not null) q = q.Where(r => r.WarehouseId == warehouseId); diff --git a/Backend/ERPCore/Services/RequisitionService.cs b/Backend/ERPCore/Services/RequisitionService.cs index 9ea01bc..36b096c 100644 --- a/Backend/ERPCore/Services/RequisitionService.cs +++ b/Backend/ERPCore/Services/RequisitionService.cs @@ -40,7 +40,7 @@ public sealed class RequisitionService : IRequisitionService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(r => EF.Functions.ILike(r.DocNo, $"%{term}%")); + q = q.Where(r => EF.Functions.Like(r.DocNo, $"%{term}%")); } if (status is not null) q = q.Where(r => r.Status == status); diff --git a/Backend/ERPCore/Services/RfqService.cs b/Backend/ERPCore/Services/RfqService.cs index 785a887..a2fcb13 100644 --- a/Backend/ERPCore/Services/RfqService.cs +++ b/Backend/ERPCore/Services/RfqService.cs @@ -43,7 +43,7 @@ public sealed class RfqService : IRfqService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(r => EF.Functions.ILike(r.DocNo, $"%{term}%")); + q = q.Where(r => EF.Functions.Like(r.DocNo, $"%{term}%")); } if (status is not null) q = q.Where(r => r.Status == status); diff --git a/Backend/ERPCore/Services/RoleService.cs b/Backend/ERPCore/Services/RoleService.cs index 4197088..34d0c5c 100644 --- a/Backend/ERPCore/Services/RoleService.cs +++ b/Backend/ERPCore/Services/RoleService.cs @@ -47,7 +47,7 @@ public sealed class RoleService : IRoleService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(r => EF.Functions.ILike(r.Code, $"%{term}%") || EF.Functions.ILike(r.Name, $"%{term}%")); + q = q.Where(r => EF.Functions.Like(r.Code, $"%{term}%") || EF.Functions.Like(r.Name, $"%{term}%")); } if (status is not null) q = q.Where(r => r.Status == status); diff --git a/Backend/ERPCore/Services/SalesInvoiceService.cs b/Backend/ERPCore/Services/SalesInvoiceService.cs index 4ca9888..9b4b7bb 100644 --- a/Backend/ERPCore/Services/SalesInvoiceService.cs +++ b/Backend/ERPCore/Services/SalesInvoiceService.cs @@ -57,7 +57,7 @@ public sealed class SalesInvoiceService : ISalesInvoiceService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(x => EF.Functions.ILike(x.InvoiceNo, $"%{term}%") || EF.Functions.ILike(x.CustomerSnapshotName, $"%{term}%")); + q = q.Where(x => EF.Functions.Like(x.InvoiceNo, $"%{term}%") || EF.Functions.Like(x.CustomerSnapshotName, $"%{term}%")); } if (status is not null) q = q.Where(x => x.Status == status); if (customerId is not null) q = q.Where(x => x.CustomerId == customerId); @@ -140,7 +140,15 @@ public sealed class SalesInvoiceService : ISalesInvoiceService foreach (var line in await BuildLinesAsync(request.WarehouseId, request.Lines, ct)) invoice.Lines.Add(line); Recalculate(invoice); invoice.UpdatedAt = DateTime.UtcNow; - await _uow.SaveChangesAsync(ct); + try + { + await _uow.SaveChangesAsync(ct); + } + catch (DbUpdateConcurrencyException) + { + throw new DomainException(ErrorCodes.ConcurrencyConflict, "The sales invoice was modified by another request.", 412); + } + return new ETagged(_mapping.MapInvoice(invoice), invoice.RowVersion); } diff --git a/Backend/ERPCore/Services/SalesReturnService.cs b/Backend/ERPCore/Services/SalesReturnService.cs index 2eeecbd..890af7e 100644 --- a/Backend/ERPCore/Services/SalesReturnService.cs +++ b/Backend/ERPCore/Services/SalesReturnService.cs @@ -73,7 +73,7 @@ public sealed class SalesReturnService : ISalesReturnService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(r => EF.Functions.ILike(r.DocNo, $"%{term}%")); + q = q.Where(r => EF.Functions.Like(r.DocNo, $"%{term}%")); } if (customerId is not null) q = q.Where(r => r.CustomerId == customerId); if (warehouseId is not null) q = q.Where(r => r.WarehouseId == warehouseId); diff --git a/Backend/ERPCore/Services/SalesSlipService.cs b/Backend/ERPCore/Services/SalesSlipService.cs index 24a46e5..bdafaad 100644 --- a/Backend/ERPCore/Services/SalesSlipService.cs +++ b/Backend/ERPCore/Services/SalesSlipService.cs @@ -66,7 +66,7 @@ public sealed class SalesSlipService : ISalesSlipService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(x => EF.Functions.ILike(x.SlipNo, $"%{term}%") || EF.Functions.ILike(x.CustomerSnapshotName, $"%{term}%")); + q = q.Where(x => EF.Functions.Like(x.SlipNo, $"%{term}%") || EF.Functions.Like(x.CustomerSnapshotName, $"%{term}%")); } if (status is not null) q = q.Where(x => x.Status == status); if (customerId is not null) q = q.Where(x => x.CustomerId == customerId); @@ -91,7 +91,7 @@ public sealed class SalesSlipService : ISalesSlipService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(x => EF.Functions.ILike(x.SlipNo, $"%{term}%") || EF.Functions.ILike(x.CustomerSnapshotName, $"%{term}%")); + q = q.Where(x => EF.Functions.Like(x.SlipNo, $"%{term}%") || EF.Functions.Like(x.CustomerSnapshotName, $"%{term}%")); } if (status is not null) q = q.Where(x => x.Status == status); if (customerId is not null) q = q.Where(x => x.CustomerId == customerId); @@ -165,7 +165,15 @@ public sealed class SalesSlipService : ISalesSlipService foreach (var line in await BuildLinesAsync(request.WarehouseId, request.Lines, ct)) slip.Lines.Add(line); Recalculate(slip, request.PaidAmount); slip.UpdatedAt = DateTime.UtcNow; - await _uow.SaveChangesAsync(ct); + try + { + await _uow.SaveChangesAsync(ct); + } + catch (DbUpdateConcurrencyException) + { + throw new DomainException(ErrorCodes.ConcurrencyConflict, "The sales slip was modified by another request.", 412); + } + return new ETagged(_mapping.MapSlip(slip), slip.RowVersion); } diff --git a/Backend/ERPCore/Services/Stock/FifoCostingService.cs b/Backend/ERPCore/Services/Stock/FifoCostingService.cs index 175e4d9..4e2ecda 100644 --- a/Backend/ERPCore/Services/Stock/FifoCostingService.cs +++ b/Backend/ERPCore/Services/Stock/FifoCostingService.cs @@ -78,24 +78,93 @@ public sealed class FifoCostingService : IFifoCostingService $"Batch {batchId} expired on {expiry:yyyy-MM-dd} and cannot be issued.", 409); } - // Row-lock the issuable open layers oldest-first (SELECT … FOR UPDATE, NFR-02), plus any - // shortfall (negative) layers left by an over-stock sale. Excludes on-hold and rejected - // (grn line) and expired-batch stock — rejected stock sits quarantined until a Purchase - // Return consumes it directly (see PurchaseReturnService), never through this - // general-issue path. No LINQ is composed on top of the raw SQL so the FOR UPDATE - // reaches the database intact. - var locked = await _db.StockLayers - .FromSqlInterpolated($""" - SELECT * FROM stock_layers sl - WHERE sl."ItemId" = {itemId} AND sl."WarehouseId" = {warehouseId} - AND (sl."QtyRemaining" < 0 OR (sl."QtyRemaining" > 0 - AND NOT EXISTS (SELECT 1 FROM grn_lines gl WHERE gl."GrnLineId" = sl."GrnLineId" AND gl."HoldStatus" IN ('OnHold', 'Rejected')) - AND NOT EXISTS (SELECT 1 FROM batches b WHERE b."BatchId" = sl."BatchId" AND b."ExpiryDate" < {today}))) - ORDER BY sl."ReceiptDate", sl."LayerId" - FOR UPDATE + // Row-lock the issuable open layers oldest-first (NFR-02), plus any shortfall (negative) + // layers left by an over-stock sale, in two steps. + // + // Why two steps: InnoDB's locking clause applies to EVERY table a statement reads, + // including rows pulled in by the NOT EXISTS subqueries. A single-statement + // `... NOT EXISTS (grn_lines) ... FOR UPDATE` would therefore also X-lock grn_lines + // and batches rows, which creates a lock cycle against GrnService (it mutates + // HoldStatus). PostgreSQL locked only the outer FROM list, and MySQL 8.0.1+ can scope + // a lock with `FOR UPDATE OF sl` — but MariaDB has no `OF` clause at all (verified: + // syntax error). So step 1 evaluates the exclusions WITHOUT a locking clause, and + // step 2 locks exactly those ids against stock_layers alone. + // + // Excludes on-hold and rejected (grn line) and expired-batch stock — rejected stock + // sits quarantined until a Purchase Return consumes it directly (see + // PurchaseReturnService), never through this general-issue path. The exclusions apply + // to positive layers only: a shortfall layer carries no GrnLineId and no BatchId, and + // must be settled no matter which batch the caller asked for, so it is never filtered + // out here. The batch filter is deliberately NOT in this query for the same reason — + // it is applied after settlement, below. + var candidateIds = await _db.Database + .SqlQuery($""" + SELECT sl.`LayerId` AS `Value` FROM `stock_layers` sl + WHERE sl.`ItemId` = {itemId} AND sl.`WarehouseId` = {warehouseId} + AND (sl.`QtyRemaining` < 0 OR (sl.`QtyRemaining` > 0 + AND NOT EXISTS (SELECT 1 FROM `grn_lines` gl WHERE gl.`GrnLineId` = sl.`GrnLineId` AND gl.`HoldStatus` IN ('OnHold', 'Rejected')) + AND NOT EXISTS (SELECT 1 FROM `batches` b WHERE b.`BatchId` = sl.`BatchId` AND b.`ExpiryDate` < {today}))) + ORDER BY sl.`ReceiptDate`, sl.`LayerId` """) .ToListAsync(ct); + // `IN ()` is a syntax error, so short-circuit to the normal insufficient-stock path. + List locked; + if (candidateIds.Count == 0) + { + locked = new List(); + } + else + { + // SELECT sl.* (not *) and no LINQ composed on top: composition would wrap this in a + // derived table and the locking clause would be lost. Safe because StockLayer has no + // RowVersion and no shadow properties — note that if one is ever added, `*` WOULD + // return it here (a real column), unlike PostgreSQL's system-column xmin. + // Injection-safe by type, not by escaping: candidateIds is List read straight + // back from the database, so it can only ever render as digits and commas. + var idList = string.Join(",", candidateIds); + // EF1002 is suppressed deliberately, not ignored: a parameterised IN list is not + // an option here because the parameter count varies per call, and FromSql would + // not let the `FOR UPDATE` survive. idList is built from List, so it cannot + // contain anything but digits and commas. +#pragma warning disable EF1002 // Possible SQL injection vulnerability — see above. + locked = await _db.StockLayers + .FromSqlRaw($""" + SELECT sl.* FROM `stock_layers` sl + WHERE sl.`LayerId` IN ({idList}) AND sl.`QtyRemaining` <> 0 + ORDER BY sl.`ReceiptDate`, sl.`LayerId` + FOR UPDATE + """) + .ToListAsync(ct); + + // Re-validate under the locks. Between step 1 and step 2 a layer could have gone + // on-hold or had its batch expire; now that the rows are locked nothing can change + // under us, so this restores the single-statement guarantee. + // + // SqlQueryRaw, NOT SqlQuery: the interpolating overload takes a FormattableString + // and turns every hole into a DbParameter, so `IN ({idList})` would bind the whole + // list as ONE string — MariaDB coerces '3,4,5' to the integer 3 and silently keeps + // only the first layer. Raw keeps the list as SQL; `today` is the one real value + // here and goes through SqlQueryRaw's positional placeholder {0}. Note the $$ raw + // string: with two $ the interpolation holes are {{...}}, which leaves the literal + // {0} alone for EF to bind rather than C# swallowing it. + if (locked.Count > 0) + { + var stillIssuable = await _db.Database + .SqlQueryRaw($$""" + SELECT sl.`LayerId` AS `Value` FROM `stock_layers` sl + WHERE sl.`LayerId` IN ({{idList}}) + AND (sl.`QtyRemaining` < 0 OR ( + NOT EXISTS (SELECT 1 FROM `grn_lines` gl WHERE gl.`GrnLineId` = sl.`GrnLineId` AND gl.`HoldStatus` IN ('OnHold', 'Rejected')) + AND NOT EXISTS (SELECT 1 FROM `batches` b WHERE b.`BatchId` = sl.`BatchId` AND b.`ExpiryDate` < {0}))) + """, today) + .ToListAsync(ct); + var issuable = stillIssuable.ToHashSet(); + locked = locked.Where(l => issuable.Contains(l.LayerId)).ToList(); + } +#pragma warning restore EF1002 + } + // Stock sold before it arrived is owed first: net shortfall layers off against issuable // stock (oldest-first) before anything new is issued, so it can't be sold twice. The // sale already posted its ledger Out, so settling writes no ledger entry of its own. @@ -112,7 +181,10 @@ public sealed class FifoCostingService : IFifoCostingService } } + // Only now apply the caller's batch filter: settlement above is deliberately + // batch-agnostic (a shortfall layer has no batch), but the issue itself is not. var layers = open.Where(l => l.QtyRemaining > 0 && (batchId == null || l.BatchId == batchId)).ToList(); + var available = layers.Sum(l => l.QtyRemaining); if (available < qtyBase && !allowShortfall) { diff --git a/Backend/ERPCore/Services/TaxRateService.cs b/Backend/ERPCore/Services/TaxRateService.cs index 8eb9523..215fc7a 100644 --- a/Backend/ERPCore/Services/TaxRateService.cs +++ b/Backend/ERPCore/Services/TaxRateService.cs @@ -29,7 +29,7 @@ public sealed class TaxRateService : ITaxRateService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(t => EF.Functions.ILike(t.Code, $"%{term}%") || EF.Functions.ILike(t.Name, $"%{term}%")); + q = q.Where(t => EF.Functions.Like(t.Code, $"%{term}%") || EF.Functions.Like(t.Name, $"%{term}%")); } if (status is not null) q = q.Where(t => t.Status == status); diff --git a/Backend/ERPCore/Services/TransferService.cs b/Backend/ERPCore/Services/TransferService.cs index 97c16b5..a4036c8 100644 --- a/Backend/ERPCore/Services/TransferService.cs +++ b/Backend/ERPCore/Services/TransferService.cs @@ -62,7 +62,7 @@ public sealed class TransferService : ITransferService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(t => EF.Functions.ILike(t.DocNo, $"%{term}%")); + q = q.Where(t => EF.Functions.Like(t.DocNo, $"%{term}%")); } if (status is not null) q = q.Where(t => t.Status == status); if (srcWarehouseId is not null) q = q.Where(t => t.SrcWarehouseId == srcWarehouseId); diff --git a/Backend/ERPCore/Services/UomService.cs b/Backend/ERPCore/Services/UomService.cs index 3a7f192..08c5fb6 100644 --- a/Backend/ERPCore/Services/UomService.cs +++ b/Backend/ERPCore/Services/UomService.cs @@ -27,7 +27,7 @@ public sealed class UomService : IUomService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(u => EF.Functions.ILike(u.Name, $"%{term}%")); + q = q.Where(u => EF.Functions.Like(u.Name, $"%{term}%")); } if (status is not null) q = q.Where(u => u.Status == status); diff --git a/Backend/ERPCore/Services/UserManagementService.cs b/Backend/ERPCore/Services/UserManagementService.cs index d634392..048dd46 100644 --- a/Backend/ERPCore/Services/UserManagementService.cs +++ b/Backend/ERPCore/Services/UserManagementService.cs @@ -43,10 +43,10 @@ public sealed class UserManagementService : IUserManagementService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(u => EF.Functions.ILike(u.Username, $"%{term}%") || EF.Functions.ILike(u.DisplayName, $"%{term}%")); + q = q.Where(u => EF.Functions.Like(u.Username, $"%{term}%") || EF.Functions.Like(u.DisplayName, $"%{term}%")); } if (status is not null) q = q.Where(u => u.Status == status); - if (!string.IsNullOrWhiteSpace(roleCode)) q = q.Where(u => u.Role != null && EF.Functions.ILike(u.Role.Code, roleCode)); + if (!string.IsNullOrWhiteSpace(roleCode)) q = q.Where(u => u.Role != null && u.Role.Code == roleCode); var total = await q.CountAsync(ct); var rows = await q.OrderBy(u => u.Username) diff --git a/Backend/ERPCore/Services/VendorService.cs b/Backend/ERPCore/Services/VendorService.cs index 19f0b27..238865a 100644 --- a/Backend/ERPCore/Services/VendorService.cs +++ b/Backend/ERPCore/Services/VendorService.cs @@ -30,7 +30,7 @@ public sealed class VendorService : IVendorService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(v => EF.Functions.ILike(v.Code, $"%{term}%") || EF.Functions.ILike(v.Name, $"%{term}%")); + q = q.Where(v => EF.Functions.Like(v.Code, $"%{term}%") || EF.Functions.Like(v.Name, $"%{term}%")); } if (status is not null) q = q.Where(v => v.Status == status); diff --git a/Backend/ERPCore/Services/WarehouseService.cs b/Backend/ERPCore/Services/WarehouseService.cs index dcea79e..687f56d 100644 --- a/Backend/ERPCore/Services/WarehouseService.cs +++ b/Backend/ERPCore/Services/WarehouseService.cs @@ -34,7 +34,7 @@ public sealed class WarehouseService : IWarehouseService if (!string.IsNullOrWhiteSpace(query.Q)) { var term = query.Q.Trim(); - q = q.Where(w => EF.Functions.ILike(w.Code, $"%{term}%") || EF.Functions.ILike(w.Name, $"%{term}%")); + q = q.Where(w => EF.Functions.Like(w.Code, $"%{term}%") || EF.Functions.Like(w.Name, $"%{term}%")); } if (branchId is not null) q = q.Where(w => w.BranchId == branchId); diff --git a/Backend/ERPCore/appsettings.Development.json b/Backend/ERPCore/appsettings.Development.json index a74bfab..c80290e 100644 --- a/Backend/ERPCore/appsettings.Development.json +++ b/Backend/ERPCore/appsettings.Development.json @@ -6,7 +6,7 @@ } }, "ConnectionStrings": { - "DefaultConnection": "Host=localhost;Port=5433;Database=ERPCoreTest;Username=postgres;Password=post@hexdive" + "DefaultConnection": "server=187.127.102.190;port=3306;database=erpcore;user=poojathmi;password=poojathmi@hexdive.com" }, "AuthHex": { "BaseUrl": "http://localhost:5011" diff --git a/Backend/ERPCore/appsettings.Production.json b/Backend/ERPCore/appsettings.Production.json index dc6cf26..890c884 100644 --- a/Backend/ERPCore/appsettings.Production.json +++ b/Backend/ERPCore/appsettings.Production.json @@ -4,5 +4,9 @@ }, "AuthHex": { "BaseUrl": "http://localhost:6703" + }, + "GeneralLedgerService": { + "BaseUrl": "http://localhost:6704/api/v1/", + "ApiKey": "1A5FE0E389C029B1FBCD2A94650CEBF0656083BF06FF48E5E11987040ABA262D" } } diff --git a/Backend/ERPCore/appsettings.json b/Backend/ERPCore/appsettings.json index d66d083..4676ad0 100644 --- a/Backend/ERPCore/appsettings.json +++ b/Backend/ERPCore/appsettings.json @@ -14,7 +14,7 @@ "Audience": "AuthHexClient", "RsaPublicKeyXml": "1LlNkMBQNdpXJiDal7XMxkG/3ad+YBsMCuY9JD/abHMzniFXtQlovjfbeaaHJ0v1kvSo9731CJ0YC1qhPU5rPQwZwxOWZ9BOBZlMDghONdjOH/HyCUbb5Z18ibqc0QenFSnEYz+jkVZiayj8DV/+VUe+eKzpQTlU6aWtHvlbwfuXaDu+QvFlpLJ7/m8na+0s2nYhLX8Wfi4C/2AoNaYhFkIwYhMMGoaSHuIoQ5R6181Rh0gKvYopRW+IpTD5RV8bXV3AM6zOcoisOifBYROHwA5ZZpoHXuTvHYmPWW8kL8PKme7BwBldPi8KrJUroRE+WXA87aAA5Wtt1oxePcXvhQ==AQAB", "RequiredUserTypeCode": "", - "RequiredRoleCode": "" + "RequiredRoleCode": " " }, "AuthHex": { "BaseUrl": "http://localhost:6703" @@ -24,7 +24,7 @@ "MaxSizeBytes": 10485760 }, "GeneralLedgerService": { - "BaseUrl": "https://localhost:7024/api/v1/", + "BaseUrl": "http://localhost:6704", "ApiKey": "1A5FE0E389C029B1FBCD2A94650CEBF0656083BF06FF48E5E11987040ABA262D" }, "Grn": { diff --git a/Backend/smoke/__pycache__/smoke_common.cpython-313.pyc b/Backend/smoke/__pycache__/smoke_common.cpython-313.pyc index 3e7c7a8..9fa76c3 100644 Binary files a/Backend/smoke/__pycache__/smoke_common.cpython-313.pyc and b/Backend/smoke/__pycache__/smoke_common.cpython-313.pyc differ diff --git a/Backend/smoke/m8_concurrency.py b/Backend/smoke/m8_concurrency.py new file mode 100644 index 0000000..4d1eecb --- /dev/null +++ b/Backend/smoke/m8_concurrency.py @@ -0,0 +1,144 @@ +"""Concurrency smoke tests for the MySQL/MariaDB port (R4 in the migration plan). + +These cover what no other suite can: on PostgreSQL the ETag token was the `xmin` system +column, maintained by the engine. On MariaDB it is a real `RowVersion int unsigned` column +incremented by ErpDbContext.BumpRowVersions(). The InMemory unit-test provider does not +implement optimistic concurrency at all, so it stays green whether that works or not. + +Run order matters: R4.1 gates everything else. If the ETag does not change across an +update, nothing downstream is meaningful. + +Usage: + python m8_concurrency.py [--api URL] [--auth URL] [--user EMAIL] [--password PW] +""" + +from __future__ import annotations + +import concurrent.futures +import json +import uuid +import urllib.error +import urllib.request + +from smoke_common import bootstrap + + +def uniqueish() -> str: + return uuid.uuid4().hex[:8] + + +def _raw_request(client, method: str, path: str, body=None, headers=None): + """Request that returns (status, body, headers) without raising on 4xx.""" + url = f"{client.api.rstrip('/')}{path}" + data = json.dumps(body).encode() if body is not None else None + req = urllib.request.Request(url, data=data, method=method) + req.add_header("Authorization", f"Bearer {client.token}") + if data is not None: + req.add_header("Content-Type", "application/json") + for k, v in (headers or {}).items(): + req.add_header(k, v) + try: + with urllib.request.urlopen(req) as r: + raw = r.read() + return r.status, (json.loads(raw) if raw else None), dict(r.headers) + except urllib.error.HTTPError as e: + raw = e.read() + try: + parsed = json.loads(raw) if raw else None + except json.JSONDecodeError: + parsed = raw.decode(errors="replace") + return e.code, parsed, dict(e.headers) + + +def main() -> int: + client, check, args = bootstrap("MySQL port concurrency tests") + + print("\nR4.1 ETag round-trip (gates every test below)") + suffix = uniqueish() + status, brand, headers = _raw_request(client, "POST", "/brands", {"name": f"E2E Brand {suffix}"}) + check.check("POST /brands -> 201", status, 201) + brand_id = (brand or {}).get("brandId") + etag_1 = headers.get("ETag") + print(f" brandId={brand_id} ETag={etag_1}") + check.check("create returns an ETag", etag_1 is not None, True) + # Added -> 1 means the token is never the all-zero "AAAAAA==" a default uint produces. + check.check('new row ETag is not the all-zero token', etag_1 != '"AAAAAA=="', True) + + status, _, headers = _raw_request( + client, "PUT", f"/brands/{brand_id}", + {"name": f"E2E Brand {suffix} renamed"}, {"If-Match": etag_1}) + check.check("PUT with current ETag -> 200", status, 200) + etag_2 = headers.get("ETag") + print(f" new ETag={etag_2}") + check.check("ETag CHANGED after update (the whole point)", etag_2 != etag_1, True) + + status, _, _ = _raw_request( + client, "PUT", f"/brands/{brand_id}", + {"name": f"E2E Brand {suffix} again"}, {"If-Match": etag_1}) + check.check("PUT with the STALE ETag -> 412", status, 412) + + status, _, _ = _raw_request( + client, "PUT", f"/brands/{brand_id}", {"name": f"E2E Brand {suffix} no match"}) + check.check("PUT with no If-Match -> 428", status, 428) + + print("\nR4.2 Lost update: two concurrent PUTs with the same valid ETag") + status, brand, headers = _raw_request(client, "POST", "/brands", {"name": f"E2E Race {suffix}"}) + race_id = (brand or {}).get("brandId") + race_etag = headers.get("ETag") + + def put(n): + return _raw_request(client, "PUT", f"/brands/{race_id}", + {"name": f"E2E Race {suffix} w{n}"}, {"If-Match": race_etag})[0] + + with concurrent.futures.ThreadPoolExecutor(max_workers=2) as pool: + codes = sorted(pool.map(put, range(2))) + print(f" status codes={codes}") + check.check("exactly one 200", codes.count(200), 1) + check.check("exactly one 412", codes.count(412), 1) + + print("\nR4.3 Document numbers are unique under concurrency (upsert + RETURNING)") + # Requisitions mint a doc number through NumberSequenceService inside a UoW transaction. + # N parallel creates must yield N DISTINCT numbers. This is the test that would catch a + # broken upsert: the LAST_INSERT_ID variant, or an INSERT-then-SELECT split, hands the + # same number to two callers. + _, branches, _ = _raw_request(client, "GET", "/branches?page=1&pageSize=1") + branch_id = ((branches or {}).get("items") or [{}])[0].get("branchId") + check.check("seeded default branch is reachable", branch_id is not None, True) + + _, cat, _ = _raw_request(client, "POST", "/categories", {"name": f"E2E Cat {suffix}"}) + _, uom, _ = _raw_request(client, "POST", "/uoms", {"name": f"E2E-U-{suffix}"}) + st, item, _ = _raw_request(client, "POST", "/items", { + "sku": f"E2E-SKU-{suffix}", "name": f"E2E Item {suffix}", + "categoryId": (cat or {}).get("categoryId"), + "baseUomId": (uom or {}).get("uomId"), + "stockNature": "Stocked", "trackingMode": "None"}) + check.check("fixture item created", st, 201) + item_id = (item or {}).get("itemId") + + n_parallel = 8 + + def make_requisition(_): + s, b, _h = _raw_request(client, "POST", "/requisitions", { + "branchId": branch_id, + "lines": [{"itemId": item_id, "qty": 1}]}) + return s, (b or {}).get("docNo") + + with concurrent.futures.ThreadPoolExecutor(max_workers=n_parallel) as pool: + results = list(pool.map(make_requisition, range(n_parallel))) + statuses = [s for s, _ in results] + doc_nos = [d for s, d in results if s == 201 and d] + print(f" statuses={statuses}") + print(f" docNos={doc_nos}") + check.check(f"all {n_parallel} requisitions created", len(doc_nos), n_parallel) + check.check("every document number is DISTINCT", len(set(doc_nos)), len(doc_nos)) + check.check("doc numbers carry the branch code", + all("BR-000" in d for d in doc_nos) if doc_nos else False, True) + + print("\n" + "=" * 62) + print(f" PASSED {check.passed} FAILED {check.failed}") + print("=" * 62) + return 1 if check.failed else 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/Backend/smoke/m9_fifo.py b/Backend/smoke/m9_fifo.py new file mode 100644 index 0000000..81d6f16 --- /dev/null +++ b/Backend/smoke/m9_fifo.py @@ -0,0 +1,149 @@ +"""FIFO stock-consumption tests for the MariaDB port (R4.6 in the migration plan). + +FifoCostingService.ConsumeAsync had to be redesigned, not translated: MariaDB has no +`FOR UPDATE OF ` (MySQL 8.0.1+ only), and InnoDB's locking clause otherwise applies +to every table a statement reads — so a single-statement `... NOT EXISTS (grn_lines) ... +FOR UPDATE` would also X-lock grn_lines and batches, deadlocking against GrnService. It is +now a two-step: unlocked candidate SELECT, then a locking read scoped to stock_layers, +then a re-validation under the locks. + +Usage: + python m9_fifo.py [--api URL] [--auth URL] [--user EMAIL] [--password PW] +""" + +from __future__ import annotations + +import concurrent.futures +import json +import urllib.error +import urllib.request +import uuid + +from smoke_common import bootstrap + + +def _req(client, method: str, path: str, body=None, headers=None): + url = f"{client.api.rstrip('/')}{path}" + data = json.dumps(body).encode() if body is not None else None + r = urllib.request.Request(url, data=data, method=method) + r.add_header("Authorization", f"Bearer {client.token}") + if data is not None: + r.add_header("Content-Type", "application/json") + for k, v in (headers or {}).items(): + r.add_header(k, v) + try: + with urllib.request.urlopen(r) as resp: + raw = resp.read() + return resp.status, (json.loads(raw) if raw else None) + except urllib.error.HTTPError as e: + raw = e.read() + try: + return e.code, (json.loads(raw) if raw else None) + except json.JSONDecodeError: + return e.code, raw.decode(errors="replace") + + +def main() -> int: + client, check, _args = bootstrap("MariaDB FIFO consumption tests") + sfx = uuid.uuid4().hex[:8] + + print("\nFixtures") + _, branches = _req(client, "GET", "/branches?page=1&pageSize=1") + branch_id = ((branches or {}).get("items") or [{}])[0].get("branchId") + + st, wh = _req(client, "POST", "/warehouses", + {"code": f"F-W-{sfx}", "name": f"FIFO WH {sfx}", "branchId": branch_id}) + check.check("warehouse created", st, 201) + wh_id = (wh or {}).get("warehouseId") + + _, cat = _req(client, "POST", "/categories", {"name": f"FIFO Cat {sfx}"}) + _, uom = _req(client, "POST", "/uoms", {"name": f"F-U-{sfx}"}) + st, item = _req(client, "POST", "/items", { + "sku": f"F-SKU-{sfx}", "name": f"FIFO Item {sfx}", + "categoryId": (cat or {}).get("categoryId"), "baseUomId": (uom or {}).get("uomId"), + "stockNature": "Stocked", "trackingMode": "None"}) + check.check("item created", st, 201) + item_id = (item or {}).get("itemId") + + st, vendor = _req(client, "POST", "/vendors", + {"code": f"F-V-{sfx}", "name": f"FIFO Vendor {sfx}", + "currency": "LKR", "branchId": branch_id}) + check.check("vendor created", st, 201) + vendor_id = (vendor or {}).get("vendorId") + + print("\nInbound: two FIFO layers at different costs") + grn_ids = [] + for qty, cost in ((10, 100), (10, 150)): + st, grn = _req(client, "POST", "/grns", { + "vendorId": vendor_id, "warehouseId": wh_id, "branchId": branch_id, + "lines": [{"itemId": item_id, "qty": qty, "unitCost": cost}]}) + if st != 201: + print(f" GRN create failed {st}: {grn}") + check.check(f"GRN qty={qty} @ {cost} created", st, 201) + break + grn_id = (grn or {}).get("grnId") + grn_ids.append(grn_id) + st2, _ = _req(client, "POST", f"/grns/{grn_id}/confirm", {}) + check.check(f"GRN {grn_id} (qty {qty} @ {cost}) confirmed", st2 in (200, 204), True) + + st, onhand = _req(client, "GET", f"/stock/on-hand?itemId={item_id}&warehouseId={wh_id}") + print(f" on-hand response: {onhand}") + + print("\nFIFO consume via a negative adjustment (exercises the two-step locking read)") + _, reasons = _req(client, "GET", "/reason-codes?context=Adjustment") + rlist = (reasons or {}).get("items") or reasons or [] + var = next((r for r in rlist if r.get("code") == "VAR"), None) + check.check("seeded reason code VAR present", var is not None, True) + reason_id = (var or {}).get("reasonCodeId") + + # Consume 15 of 20: must take all 10 @100 then 5 @150 => cost 1750, oldest-first. + st, adj = _req(client, "POST", "/stock-adjustments", { + "warehouseId": wh_id, "branchId": branch_id, "reasonCodeId": reason_id, + "lines": [{"itemId": item_id, "qtyDelta": -15}]}) + print(f" adjustment -> {st}: {json.dumps(adj)[:400] if adj else None}") + check.check("negative adjustment accepted (FIFO consume ran)", st, 201) + + st, val = _req(client, "GET", f"/stock/valuation?itemId={item_id}&warehouseId={wh_id}") + print(f" valuation: {json.dumps(val)[:400] if val else None}") + if isinstance(val, dict): + check.check("5 units remain after consuming 15 of 20", val.get("totalQty"), 5) + # the survivor is the newer, dearer layer + check.check("remaining value is 5 @ 150 = 750", val.get("totalValue"), 750) + + print("\nOver-issue must be blocked, not allowed negative") + st, body = _req(client, "POST", "/stock-adjustments", { + "warehouseId": wh_id, "branchId": branch_id, "reasonCodeId": reason_id, + "lines": [{"itemId": item_id, "qtyDelta": -999}]}) + code = (body or {}).get("code") if isinstance(body, dict) else None + print(f" over-issue -> {st} code={code}") + check.check("over-issue rejected with 409", st, 409) + check.check("error code is STOCK_NEGATIVE_BLOCKED", code, "STOCK_NEGATIVE_BLOCKED") + + print("\nConcurrent issue of the last 5 units: exactly one wins") + def issue(_): + s, b = _req(client, "POST", "/stock-adjustments", { + "warehouseId": wh_id, "branchId": branch_id, "reasonCodeId": reason_id, + "lines": [{"itemId": item_id, "qtyDelta": -5}]}) + return s, ((b or {}).get("code") if isinstance(b, dict) else None) + + with concurrent.futures.ThreadPoolExecutor(max_workers=2) as pool: + out = list(pool.map(issue, range(2))) + print(f" results={out}") + oks = [s for s, _ in out if s == 201] + check.check("exactly one issue succeeded", len(oks), 1) + check.check("the loser was blocked, not a 500", + all(s in (201, 409) for s, _ in out), True) + + st, val = _req(client, "GET", f"/stock/valuation?itemId={item_id}&warehouseId={wh_id}") + if isinstance(val, dict): + check.check("stock never went negative", (val.get("totalQty") or 0) >= 0, True) + print(f" final qty={val.get('totalQty')}") + + print("\n" + "=" * 62) + print(f" PASSED {check.passed} FAILED {check.failed}") + print("=" * 62) + return 1 if check.failed else 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/Testing/e2e/support/api.ts b/Testing/e2e/support/api.ts index d8f90b4..9b13878 100644 --- a/Testing/e2e/support/api.ts +++ b/Testing/e2e/support/api.ts @@ -66,32 +66,58 @@ export class ApiSeeder { return res.json() } - // --- reference data (relies on DataSeeder's MAIN/SHOP/PCS/BOX/General Goods seed) ----- + // --- reference data: get-or-create ------------------------------------------------ + // + // These used to assume DataSeeder had planted MAIN/SHOP warehouses, PCS/BOX UOMs and a + // "General Goods" category, and threw if they were missing. That demo data was removed + // with the MySQL port so a fresh database is production-shaped, so each helper now creates + // what it needs. This also removes the suite's hidden dependency on seed data that a real + // deployment would never have. async firstWarehouse(): Promise { const page = await this.get<{ items: Warehouse[] }>("/warehouses?page=1&pageSize=1") - if (!page.items.length) throw new Error("No warehouses found - expected DataSeeder's MAIN warehouse to exist.") - return page.items[0] + if (page.items.length) return page.items[0] + return this.createWarehouse("E2E Main") } async secondWarehouse(): Promise { const page = await this.get<{ items: Warehouse[] }>("/warehouses?page=1&pageSize=10") - if (page.items.length < 2) throw new Error("Need at least 2 warehouses (DataSeeder seeds MAIN + SHOP).") - return page.items[1] + if (page.items.length >= 2) return page.items[1] + await this.firstWarehouse() + return this.createWarehouse("E2E Secondary") } async firstUom(): Promise { const page = await this.get<{ items: Uom[] }>("/uoms?page=1&pageSize=1") - if (!page.items.length) throw new Error("No UOMs found - expected DataSeeder's PCS uom to exist.") - return page.items[0] + if (page.items.length) return page.items[0] + return this.post("/uoms", { name: `E2E-UOM-${uniqueSuffix()}` }) } async firstCategory(): Promise { const page = await this.get<{ items: Category[] }>("/categories?page=1&pageSize=1") - if (!page.items.length) throw new Error("No categories found - expected DataSeeder's General Goods category.") + if (page.items.length) return page.items[0] + return this.post("/categories", { name: `E2E Category ${uniqueSuffix()}` }) + } + + /** The deployment's default branch (BR-000), seeded by DataSeeder.EnsureDefaultBranchAsync. */ + async firstBranch(): Promise<{ branchId: number; code: string }> { + const page = await this.get<{ items: { branchId: number; code: string }[] }>( + "/branches?page=1&pageSize=1") + if (!page.items.length) throw new Error("No branches found - expected the seeded BR-000 branch.") return page.items[0] } + async createWarehouse(namePrefix = "E2E Warehouse"): Promise { + const suffix = uniqueSuffix() + // branchId is required whenever warehouse branching is enabled, which it is by default. + const branchId = (await this.firstBranch()).branchId + return this.post("/warehouses", { + code: `E2E-W-${suffix}`, + name: `${namePrefix} ${suffix}`, + branchId, + }) + } + // --- writes used to build test fixtures ------------------------------------------- async createVendor(namePrefix = "E2E Vendor"): Promise {